[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: python-central NMU (python2.6 related)



attached patch uploaded to DELAYED/4
-- 
Piotr Ożarowski                         Debian GNU/Linux Developer
www.ozarowski.pl          www.griffith.cc           www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645
diff -Nru python-central-0.6.12/debian/changelog python-central-0.6.12+nmu1/debian/changelog
--- python-central-0.6.12/debian/changelog	2009-10-29 19:21:57.000000000 +0100
+++ python-central-0.6.12+nmu1/debian/changelog	2009-11-05 20:56:11.000000000 +0100
@@ -1,3 +1,12 @@
+python-central (0.6.12+nmu1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix move_files() to work with python2.6's new locations. Closes: 547565.
+  * Fix few typos, missing declarations and indentation errors that lead
+    to a crash.
+
+ -- Piotr Ożarowski <piotr@debian.org>  Thu, 05 Nov 2009 20:25:12 +0100
+
 python-central (0.6.12) unstable; urgency=low
 
   * Fix pycentral debhelper failure, when there are files in the root
diff -Nru python-central-0.6.12/pycentral.py python-central-0.6.12+nmu1/pycentral.py
--- python-central-0.6.12/pycentral.py	2009-10-29 19:19:04.000000000 +0100
+++ python-central-0.6.12+nmu1/pycentral.py	2009-11-05 20:54:06.000000000 +0100
@@ -1,6 +1,7 @@
 #! /usr/bin/python
 
-import fnmatch, glob, os, re, string, sys, time, cStringIO
+import glob, os, re, string, sys, time, cStringIO
+import logging
 from optparse import OptionParser
 from ConfigParser import SafeConfigParser
 
@@ -18,7 +19,7 @@
 
 shared_base = '/usr/share/pycentral/'
 shared_base2 = '/usr/share/pyshared/'
-pycentral_version = '0.6.11'
+pycentral_version = '0.6.12+nmu1'
 req_pycentral_version = '0.6.11'
 
 def samefs(path1, path2):
@@ -232,7 +233,7 @@
         for ext in ('c', 'o'):
             for fn in files:
                 fnc = fn + ext
-		yield fnc
+                yield fnc
 
 installed_runtimes = None
 default_runtime = None
@@ -242,7 +243,6 @@
     global default_runtime
 
     if not installed_runtimes:
-        import glob
         installed_runtimes = []
         default_version = pyversions.default_version(version_only=True)
         supported = pyversions.supported_versions()
@@ -294,7 +294,7 @@
     if os.path.exists(fn):
         try:
             config.readfp(open(fn))
-        except Error:
+        except:
             logging.error("error reading config file `%s'" % fn)
             sys.exit(1)
     # checks
@@ -558,27 +558,27 @@
             if pversion in ('python2.3', 'python2.4', 'python2.5'):
                 srctop = os.path.join(self.pkgdir, 'usr/lib', pversion, 'site-packages')
             else:
-                srctop2 = os.path.join(self.pkgdir, 'usr/lib', pversion, 'dist-packages')
+                srctop = os.path.join(self.pkgdir, 'usr/lib', pversion, 'dist-packages')
+                srctop2 = os.path.join(self.pkgdir, 'usr/lib', pversion, 'site-packages')
                 srctop3 = os.path.join(self.pkgdir, 'usr/local/lib', pversion, 'dist-packages')
-                if os.path.isdir(srctop2) and (os.path.isdir(srctop) or os.path.isdir(srctop3)):
+                if os.path.isdir(srctop) and (os.path.isdir(srctop2) or os.path.isdir(srctop3)):
                     raise PyCentralError, 'both directories site-packages and dist-packages exist.'
-                if os.path.isdir(srctop):
-                    print 'renaming %s to %s' % (srctop, srctop2)
-                    os.rename(srctop, srctop2)
+                if os.path.isdir(srctop2):
+                    print 'renaming %s to %s' % (srctop2, srctop)
+                    os.rename(srctop2, srctop)
                 elif os.path.isdir(srctop3):
-                    print 'renaming %s to %s' % (srctop3, srctop2)
+                    print 'renaming %s to %s' % (srctop3, srctop)
                     try:
-                        os.makedirs(os.path.dirname(srctop2))
+                        os.makedirs(os.path.dirname(srctop))
                     except OSError:
                         pass
-                    os.rename(srctop3, srctop2)
+                    os.rename(srctop3, srctop)
                     while srctop3:
                         srctop3=os.path.dirname(srctop3)
                         try:
                             os.rmdir(srctop3)
                         except OSError:
                             break
-                srctop = srctop2
             for root, dirs, files in os.walk(srctop, topdown=False):
                 for name in files:
                     m = vrx.match(name)
@@ -651,8 +651,8 @@
             # remove empty dirs in /usr/lib/pythonX.Y
             for root, dirs, files in os.walk(self.pkgdir + '/usr/lib', topdown=False):
                 try:
-		    if re.match("/usr/lib/python\d\.\d($|/)", root.replace(self.pkgdir, "")):
-			os.rmdir(root)
+                    if re.match("/usr/lib/python\d\.\d($|/)", root.replace(self.pkgdir, "")):
+                        os.rmdir(root)
                 except OSError:
                     pass
             try:
@@ -980,7 +980,7 @@
         ppos = len(self.shared_prefix)
         for fn in self.shared_files:
             fn2 = rt.prefix + fn[ppos:]
-	    yield fn2
+            yield fn2
 
 
     def install(self, runtimes, bc_option, exclude_regex,
@@ -1031,6 +1031,7 @@
             old_pylib_fs += old_pkg.other_pylib_files
 
         if old_pkg and old_pkg.shared_files:
+            ppos = len(self.shared_prefix)
             for rt in old_runtimes:
                 if rt in runtimes:
                     continue
@@ -1205,22 +1206,22 @@
                 linked_files = [ rt.prefix + fn[ppos:]
                                  for fn in self.shared_files
                                  if fn[-3:] == '.py']
-		for f in default_runtime.list_byte_code(linked_files):
-		    yield f
-		for f in self.list_shared_files(rt):
-		    yield f
+                for f in default_runtime.list_byte_code(linked_files):
+                    yield f
+                for f in self.list_shared_files(rt):
+                    yield f
         # list byte compiled files inside prefix
         if self.pylib_files:
             for pyver, files in self.pylib_files.items():
                 rt = get_runtime_for_version(pyver)
                 if rt in runtimes:
-		    for f in default_runtime.list_byte_code(files):
-			yield f
+                    for f in default_runtime.list_byte_code(files):
+                        yield f
         # list byte code for script files
         if list_script_files:
             if self.private_files:
-		for f in default_runtime.list_byte_code(self.private_files):
-		    yield f
+                for f in default_runtime.list_byte_code(self.private_files):
+                    yield f
 
     def update_bytecode_files(self, runtimes, rt_default, bc_option):
         # byte-compile with default python version
@@ -1344,11 +1345,11 @@
                     rt = get_runtime_for_version(version)
                     rt.byte_compile_dirs(dirs, bc_option, self.options.exclude)
                 if self.private_dirs:
-                    version = pkg.version_field
+                    version = self.pkg.version_field
                     if version == 'current':
                         version = pyversions.default_version(version_only=True)
                     rt = get_runtime_for_version(version)
-                    rt.byte_compile_dirs(private_dirs, bc_option, self.options.exclude)
+                    rt.byte_compile_dirs(self.private_dirs, bc_option, self.options.exclude)
             except PyCentralError:
                 self.error("error byte-compiling package `%s'" % self.pkgname)
             return
@@ -1394,14 +1395,14 @@
         try:
             pkg.set_default_runtime_from_version_info()
         except ValueError:
-	    # Package doesn't provide support for any supported runtime
-	    if len(used_runtimes) == 0:
-		self.error('%s needs unavailable runtime (%s)'
-			   % (self.pkgname, pkg.version_field))
-	    else:
-		# Still byte compile for the available runtimes (with the
-		# first matching runtime)
- 		pkg.default_runtime = get_runtime_for_version(used_runtimes[0])
+            # Package doesn't provide support for any supported runtime
+            if len(used_runtimes) == 0:
+                self.error('%s needs unavailable runtime (%s)'
+                           % (self.pkgname, pkg.version_field))
+            else:
+                # Still byte compile for the available runtimes (with the
+                # first matching runtime)
+                 pkg.default_runtime = get_runtime_for_version(used_runtimes[0])
         logging.debug('\tavail=%s, pkg=%s, install=%s'
                       % ([rt.short_name for rt in runtimes],
                          pkg.version_field,
@@ -1471,14 +1472,14 @@
         try:
             pkg.set_default_runtime_from_version_info()
         except ValueError:
-	    # Package doesn't provide support for any supported runtime
-	    if len(used_runtimes) == 0:
-		self.error('%s needs unavailable runtime (%s)'
-			   % (self.pkgname, pkg.version_field))
-	    else:
-		# Still byte compile for the available runtimes (with the
-		# first matching runtime)
- 		pkg.default_runtime = get_runtime_for_version(used_runtimes[0])
+            # Package doesn't provide support for any supported runtime
+            if len(used_runtimes) == 0:
+                self.error('%s needs unavailable runtime (%s)'
+                           % (self.pkgname, pkg.version_field))
+            else:
+                # Still byte compile for the available runtimes (with the
+                # first matching runtime)
+                 pkg.default_runtime = get_runtime_for_version(used_runtimes[0])
 
         if os.path.exists('/var/lib/dpkg/info/%s.list' % self.pkgname):
             old_pkg = DebPackage('package', self.args[0], oldstyle=False)
@@ -1589,8 +1590,8 @@
             # original runtime may be removed, use the default
             pkg.default_runtime = get_default_runtime()
         try:
-	    for f in pkg.list(runtimes, list_script_files=True):
-		print f
+            for f in pkg.list(runtimes, list_script_files=True):
+                print f
         except PyCentralError, msg:
             self.error(msg)
 
@@ -1787,11 +1788,11 @@
 
     def run(self, global_options):
         runtimes = get_installed_runtimes(with_unsupported=True)
-	for (p, v) in read_dpkg_status():
-	    pkg = DebPackage('package', p)
-	    pkg.read_version_info()
-	    for f in pkg.list(runtimes, list_script_files=True):
-		print f
+        for (p, v) in read_dpkg_status():
+            pkg = DebPackage('package', p)
+            pkg.read_version_info()
+            for f in pkg.list(runtimes, list_script_files=True):
+                print f
 
 register_action(ActionList)
 
@@ -2018,7 +2019,7 @@
     elif len(matching_actions) > 1:
         usage(sys.stderr,
               "ambiguous action `%s', matching actions: %s"
-              % (action_name, strlist(matching_actions)))
+              % (action_name, str(list(matching_actions))))
     else:
         action_name = matching_actions[0]
 

Attachment: signature.asc
Description: Digital signature


Reply to: