Commits

illume  committed 9657b58

More py3k fixes. It now can generate a .mpkg that seems to work for python3.2

  • Participants
  • Parent commits 388b087

Comments (0)

Files changed (5)

File bdist_mpkg/cmd_bdist_mpkg.py

 
     def run_copy(self):
         for scheme, source in list(self.scheme_copy.items()):
+            log.info("getting target for scheme %s" % (scheme,))
+            target = self.get_scheme_install_target(scheme)
             log.info("copying files for scheme %s" % (scheme,))
-            target = self.get_scheme_install_target(scheme)
             self.copy_tree(source, target)
 
     def run(self):
 
         This version doesn't bork on existing symlinks
         """
+        #log.info("%s, %s, %s, %s, %s, %s" % (infile, outfile, preserve_mode, preserve_times, preserve_symlinks, condition))
+        infile = unicode_(infile)
+        outfile = unicode_(outfile)
+
         update = not self.force
         dry_run = self.dry_run
         verbose = self.verbose

File bdist_mpkg/pkg.py

 from distutils.file_util import copy_file
 
 from bdist_mpkg import tools, plists
-from bdist_mpkg.util import copy_tree
+from bdist_mpkg.util import copy_tree, fsencoding
 from bdist_mpkg.templates import InstallationCheck
 
 from bdist_mpkg.compat import get_StringIO
 
 def write_template(script_strings, dest, mkpath=mkpath):
     (script, strings) = script_strings
-    
+
+    #py3k
+    script = fsencoding(script)
+
     spath = os.path.join(dest, 'InstallationCheck')
     f = open(spath, 'w')
-    f.write(script.encode('utf8'))
+    try:
+        f.write(script.encode('utf8'))
+    except TypeError: #py3k
+        f.write(script)
     f.close()
     #os.chmod(spath, os.stat(spath)[0] | 0111)
     os.chmod(spath, os.stat(spath)[0] | 73) # 73 == 0111
     mkpath(lproj)
     spath = os.path.join(lproj, 'InstallationCheck.strings')
     f = open(spath, 'w')
-    f.write(strings.encode('utf16'))
+
+    try:
+        f.write(strings.encode('utf16'))
+    except TypeError: #py3k
+        f.write(strings)
+    
     f.close()
 
 def write_sizes(count, size, compressed, pkgdir):

File bdist_mpkg/plists.py

     return dict(
         Level=Level,
         SpecType=unicode_('file'),
-        SpecArgument=tools.unicode__path(SpecArgument),
+        SpecArgument=tools.unicode_path(SpecArgument),
         SpecProperty=unicode_('NSFileType'),
         TestOperator=unicode_('eq'),
         TestObject=unicode_('NSFileTypeDirectory'),
         dprefix = os.path.dirname(fmwkprefix)
     else:
         dprefix = prefix
-    dprefix = tools.unicode__path(dprefix)
+    dprefix = tools.unicode_path(dprefix)
     name = unicode_('%s Python %s') % (FRIENDLY_PREFIX.get(dprefix, dprefix), version)
     kw.setdefault('LabelKey', name)
     title = unicode_('%s requires %s to install.' % (pkgname, name,))
         else:
             if isinstance(p, basestring_):
                 p = [p]
-            p = dict(list(zip(
-                (unicode_('IFPkgFlagPackageLocation', unicode_('IFPkgFlagPackageSelection'))),
-                p
-            )))
+            pre_zipped = [unicode_('IFPkgFlagPackageLocation'), unicode_('IFPkgFlagPackageSelection')]
+            list_p = list(zip(pre_zipped, p))
+            p = dict(list_p)
         npackages.append(p)
     d.update(dict(
         IFPkgFlagComponentDirectory=unicode_('./Contents/Packages'),

File bdist_mpkg/util.py

 def fsencoding(s, encoding=sys.getfilesystemencoding()):
     if isinstance(s, unicode_):
         s = s.encode(encoding)
+    if str(type(s)) == "<class 'bytes'>":
+        s = unicode_(s, 'utf-8')
     return s
 
 SCMDIRS = ['CVS', '.svn']
 #!/usr/bin/env python
 
-import ez_setup
-ez_setup.use_setuptools()
 
 from setuptools import setup, Extension
 
-VERSION = '0.4.4'
+VERSION = '0.4.5'
 DESCRIPTION = "Builds Mac OS X installer packages from distutils"
 LONG_DESCRIPTION = """
 bdist_mpkg is a distutils plugin that implements the bdist_mpkg command,
 It also comes with a bdist_mpkg script, which is a setup.py front-end that
 will allow you to easy build an installer metapackage from nearly any existing
 package that uses distutils.
+
+Fork of original version.
 """
 
 CLASSIFIERS = filter(None, map(str.strip,
     description=DESCRIPTION,
     long_description=LONG_DESCRIPTION,
     classifiers=CLASSIFIERS,
-    author="Bob Ippolito",
-    author_email="pythonmac-sig@python.org",
-    url="http://undefined.org/python/#bdist_mpkg",
+    author="Rene Dudfield, was Bob Ippolito",
+    author_email="renesd@gmail.com",
+    url="https://bitbucket.org/illume/bdist_mpkg",
     license="MIT License",
     packages=['bdist_mpkg'],
     platforms=['any'],