[Python-checkins] distutils2: Merge Kelsey?s edits with mine

tarek.ziade python-checkins at python.org
Wed Feb 16 22:23:56 CET 2011


tarek.ziade pushed b201575c7cdc to distutils2:

http://hg.python.org/distutils2/rev/b201575c7cdc
changeset:   1017:b201575c7cdc
parent:      1016:6a5628860de4
parent:      1012:39e2a0b88acf
user:        ?ric Araujo <merwok at netwok.org>
date:        Thu Feb 10 01:57:49 2011 +0100
summary:
  Merge Kelsey?s edits with mine

files:
  distutils2/command/bdist_dumb.py
  distutils2/command/bdist_wininst.py
  distutils2/command/clean.py
  distutils2/command/register.py
  distutils2/command/sdist.py
  distutils2/compiler/bcppcompiler.py
  distutils2/compiler/msvc9compiler.py
  distutils2/compiler/msvccompiler.py
  distutils2/compiler/unixccompiler.py
  distutils2/index/simple.py
  distutils2/index/xmlrpc.py
  distutils2/install.py
  distutils2/tests/test_manifest.py

diff --git a/distutils2/_backport/shutil.py b/distutils2/_backport/shutil.py
--- a/distutils2/_backport/shutil.py
+++ b/distutils2/_backport/shutil.py
@@ -408,7 +408,7 @@
     from distutils2._backport import tarfile
 
     if logger is not None:
-        logger.info('Creating tar archive')
+        logger.info('creating tar archive')
 
     uid = _get_uid(owner)
     gid = _get_gid(group)
diff --git a/distutils2/command/bdist_dumb.py b/distutils2/command/bdist_dumb.py
--- a/distutils2/command/bdist_dumb.py
+++ b/distutils2/command/bdist_dumb.py
@@ -128,7 +128,7 @@
 
         if not self.keep_temp:
             if self.dry_run:
-                logger.info('Removing %s', self.bdist_dir)
+                logger.info('removing %s', self.bdist_dir)
             else:
                 rmtree(self.bdist_dir)
 
diff --git a/distutils2/command/bdist_wininst.py b/distutils2/command/bdist_wininst.py
--- a/distutils2/command/bdist_wininst.py
+++ b/distutils2/command/bdist_wininst.py
@@ -192,7 +192,7 @@
 
         if not self.keep_temp:
             if self.dry_run:
-                logger.info('Removing %s', self.bdist_dir)
+                logger.info('removing %s', self.bdist_dir)
             else:
                 rmtree(self.bdist_dir)
 
diff --git a/distutils2/command/clean.py b/distutils2/command/clean.py
--- a/distutils2/command/clean.py
+++ b/distutils2/command/clean.py
@@ -48,7 +48,7 @@
         # gone)
         if os.path.exists(self.build_temp):
             if self.dry_run:
-                logger.info('Removing %s', self.build_temp)
+                logger.info('removing %s', self.build_temp)
             else:
                 rmtree(self.build_temp)
         else:
@@ -62,7 +62,7 @@
                               self.build_scripts):
                 if os.path.exists(directory):
                     if self.dry_run:
-                        logger.info('Removing %s', directory)
+                        logger.info('removing %s', directory)
                     else:
                         rmtree(directory)
                 else:
diff --git a/distutils2/command/register.py b/distutils2/command/register.py
--- a/distutils2/command/register.py
+++ b/distutils2/command/register.py
@@ -92,7 +92,7 @@
         '''
         # send the info to the server and report the result
         code, result = self.post_to_server(self.build_post_data('verify'))
-        logger.info('Server response (%s): %s', code, result)
+        logger.info('server response (%s): %s', code, result)
 
 
     def send_metadata(self):
@@ -206,9 +206,9 @@
                 data['email'] = raw_input('   EMail: ')
             code, result = self.post_to_server(data)
             if code != 200:
-                logger.info('Server response (%s): %s', code, result)
+                logger.info('server response (%s): %s', code, result)
             else:
-                logger.info('You will receive an email shortly; follow the '
+                logger.info('you will receive an email shortly; follow the '
                             'instructions in it to complete registration.')
         elif choice == '3':
             data = {':action': 'password_reset'}
@@ -216,7 +216,7 @@
             while not data['email']:
                 data['email'] = raw_input('Your email address: ')
             code, result = self.post_to_server(data)
-            logger.info('Server response (%s): %s', (code, result))
+            logger.info('server response (%s): %s', code, result)
 
     def build_post_data(self, action):
         # figure the data to send - the metadata plus some additional
diff --git a/distutils2/command/sdist.py b/distutils2/command/sdist.py
--- a/distutils2/command/sdist.py
+++ b/distutils2/command/sdist.py
@@ -332,7 +332,7 @@
 
         if not self.keep_temp:
             if self.dry_run:
-                logger.info('Removing %s', base_dir)
+                logger.info('removing %s', base_dir)
             else:
                 rmtree(base_dir)
 
diff --git a/distutils2/compiler/bcppcompiler.py b/distutils2/compiler/bcppcompiler.py
--- a/distutils2/compiler/bcppcompiler.py
+++ b/distutils2/compiler/bcppcompiler.py
@@ -191,7 +191,7 @@
             self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
 
         if runtime_library_dirs:
-            logger.warning("I don't know what to do with "
+            logger.warning("don't know what to do with "
                            "'runtime_library_dirs': %r", runtime_library_dirs)
 
         if output_dir is not None:
diff --git a/distutils2/compiler/msvc9compiler.py b/distutils2/compiler/msvc9compiler.py
--- a/distutils2/compiler/msvc9compiler.py
+++ b/distutils2/compiler/msvc9compiler.py
@@ -229,14 +229,14 @@
                 logger.debug("%s is not a valid directory", productdir)
                 return None
         else:
-            logger.debug("Env var %s is not set or invalid", toolskey)
+            logger.debug("env var %s is not set or invalid", toolskey)
     if not productdir:
-        logger.debug("No productdir found")
+        logger.debug("no productdir found")
         return None
     vcvarsall = os.path.join(productdir, "vcvarsall.bat")
     if os.path.isfile(vcvarsall):
         return vcvarsall
-    logger.debug("Unable to find vcvarsall.bat")
+    logger.debug("unable to find vcvarsall.bat")
     return None
 
 def query_vcvarsall(version, arch="x86"):
@@ -248,7 +248,7 @@
 
     if vcvarsall is None:
         raise DistutilsPlatformError("Unable to find vcvarsall.bat")
-    logger.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version)
+    logger.debug("calling 'vcvarsall.bat %s' (version=%s)", arch, version)
     popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch),
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE)
diff --git a/distutils2/compiler/msvccompiler.py b/distutils2/compiler/msvccompiler.py
--- a/distutils2/compiler/msvccompiler.py
+++ b/distutils2/compiler/msvccompiler.py
@@ -45,7 +45,7 @@
 
     except ImportError:
         logger.warning(
-            "Can't read registry to find the necessary compiler setting;\n"
+            "can't read registry to find the necessary compiler setting;\n"
             "make sure that Python modules _winreg, win32api or win32con "
             "are installed.")
 
@@ -652,7 +652,7 @@
 
 
 if get_build_version() >= 8.0:
-    logger.debug("Importing new compiler from distutils.msvc9compiler")
+    logger.debug("importing new compiler from distutils.msvc9compiler")
     OldMSVCCompiler = MSVCCompiler
     from distutils2.compiler.msvc9compiler import MSVCCompiler
     # get_build_architecture not really relevant now we support cross-compile
diff --git a/distutils2/compiler/unixccompiler.py b/distutils2/compiler/unixccompiler.py
--- a/distutils2/compiler/unixccompiler.py
+++ b/distutils2/compiler/unixccompiler.py
@@ -99,7 +99,7 @@
 
     if sysroot and not os.path.isdir(sysroot):
         logger.warning(
-            "Compiling with an SDK that doesn't seem to exist: %r;\n"
+            "compiling with an SDK that doesn't seem to exist: %r;\n"
             "please check your Xcode installation", sysroot)
 
     return compiler_so
diff --git a/distutils2/index/__init__.py b/distutils2/index/__init__.py
--- a/distutils2/index/__init__.py
+++ b/distutils2/index/__init__.py
@@ -6,6 +6,6 @@
            'xmlrpc',
            'dist',
            'errors',
-           'mirrors',]
+           'mirrors']
 
 from dist import ReleaseInfo, ReleasesList, DistInfo
diff --git a/distutils2/index/dist.py b/distutils2/index/dist.py
--- a/distutils2/index/dist.py
+++ b/distutils2/index/dist.py
@@ -109,7 +109,8 @@
                 self.dists = {}
         return self.dists
 
-    def add_distribution(self, dist_type='sdist', python_version=None, **params):
+    def add_distribution(self, dist_type='sdist', python_version=None,
+                         **params):
         """Add distribution informations to this release.
         If distribution information is already set for this distribution type,
         add the given url paths to the distribution. This can be useful while
diff --git a/distutils2/index/mirrors.py b/distutils2/index/mirrors.py
--- a/distutils2/index/mirrors.py
+++ b/distutils2/index/mirrors.py
@@ -1,4 +1,4 @@
-"""Utilities related to the mirror infrastructure defined in PEP 381. 
+"""Utilities related to the mirror infrastructure defined in PEP 381.
 See http://www.python.org/dev/peps/pep-0381/
 """
 
@@ -7,6 +7,7 @@
 
 DEFAULT_MIRROR_URL = "last.pypi.python.org"
 
+
 def get_mirrors(hostname=None):
     """Return the list of mirrors from the last record found on the DNS
     entry::
@@ -19,7 +20,7 @@
     """
     if hostname is None:
         hostname = DEFAULT_MIRROR_URL
-    
+
     # return the last mirror registered on PyPI.
     try:
         hostname = socket.gethostbyname_ex(hostname)[0]
@@ -30,23 +31,24 @@
     # determine the list from the last one.
     return ["%s.%s" % (s, end_letter[1]) for s in string_range(end_letter[0])]
 
+
 def string_range(last):
     """Compute the range of string between "a" and last.
-    
+
     This works for simple "a to z" lists, but also for "a to zz" lists.
     """
     for k in range(len(last)):
-        for x in product(ascii_lowercase, repeat=k+1):
+        for x in product(ascii_lowercase, repeat=(k + 1)):
             result = ''.join(x)
             yield result
             if result == last:
                 return
 
+
 def product(*args, **kwds):
     pools = map(tuple, args) * kwds.get('repeat', 1)
     result = [[]]
     for pool in pools:
-        result = [x+[y] for x in result for y in pool]
+        result = [x + [y] for x in result for y in pool]
     for prod in result:
         yield tuple(prod)
-
diff --git a/distutils2/index/simple.py b/distutils2/index/simple.py
--- a/distutils2/index/simple.py
+++ b/distutils2/index/simple.py
@@ -167,7 +167,7 @@
         if predicate.name.lower() in self._projects and not force_update:
             return self._projects.get(predicate.name.lower())
         prefer_final = self._get_prefer_final(prefer_final)
-        logger.info('Reading info on PyPI about %s', predicate.name)
+        logger.info('reading info on PyPI about %s', predicate.name)
         self._process_index_page(predicate.name)
 
         if predicate.name.lower() not in self._projects:
diff --git a/distutils2/index/wrapper.py b/distutils2/index/wrapper.py
--- a/distutils2/index/wrapper.py
+++ b/distutils2/index/wrapper.py
@@ -9,6 +9,7 @@
 _WRAPPER_INDEXES = {'xmlrpc': xmlrpc.Client,
                     'simple': simple.Crawler}
 
+
 def switch_index_if_fails(func, wrapper):
     """Decorator that switch of index (for instance from xmlrpc to simple)
     if the first mirror return an empty list or raises an exception.
@@ -82,11 +83,11 @@
                 other_indexes = [i for i in self._indexes
                                  if i != self._default_index]
                 for index in other_indexes:
-                    real_method = getattr(self._indexes[index], method_name, None)
+                    real_method = getattr(self._indexes[index], method_name,
+                                          None)
                     if real_method:
                         break
         if real_method:
             return switch_index_if_fails(real_method, self)
         else:
             raise AttributeError("No index have attribute '%s'" % method_name)
-
diff --git a/distutils2/index/xmlrpc.py b/distutils2/index/xmlrpc.py
--- a/distutils2/index/xmlrpc.py
+++ b/distutils2/index/xmlrpc.py
@@ -103,7 +103,6 @@
         project.sort_releases(prefer_final)
         return project
 
-
     def get_distributions(self, project_name, version):
         """Grab informations about distributions from XML-RPC.
 
diff --git a/distutils2/install.py b/distutils2/install.py
--- a/distutils2/install.py
+++ b/distutils2/install.py
@@ -76,7 +76,7 @@
     record_file = os.path.join(archive_dir, 'RECORD')
     os.system(cmd % (sys.executable, path, record_file))
     if not os.path.exists(record_file):
-        raise ValueError('Failed to install.')
+        raise ValueError('failed to install')
     return open(record_file).read().split('\n')
 
 
@@ -135,12 +135,12 @@
 
     installed_dists, installed_files = [], []
     for dist in dists:
-        logger.info('Installing %s %s', dist.name, dist.version)
+        logger.info('installing %s %s', dist.name, dist.version)
         try:
             installed_files.extend(_install_dist(dist, path))
             installed_dists.append(dist)
         except Exception, e:
-            logger.info('Failed. %s', e)
+            logger.info('failed: %s', e)
 
             # reverting
             for installed_dist in installed_dists:
@@ -244,7 +244,7 @@
     conflict.
     """
     if not installed:
-        logger.info('Reading installed distributions')
+        logger.info('reading installed distributions')
         installed = get_distributions(use_egg_info=True)
 
     infos = {'install': [], 'remove': [], 'conflict': []}
@@ -259,7 +259,7 @@
         if predicate.name.lower() != installed_project.name.lower():
             continue
         found = True
-        logger.info('Found %s %s', installed_project.name,
+        logger.info('found %s %s', installed_project.name,
                     installed_project.version)
 
         # if we already have something installed, check it matches the
@@ -269,7 +269,7 @@
         break
 
     if not found:
-        logger.info('Project not installed.')
+        logger.info('project not installed')
 
     if not index:
         index = wrapper.ClientWrapper()
@@ -284,7 +284,7 @@
     release = releases.get_last(requirements, prefer_final=prefer_final)
 
     if release is None:
-        logger.info('Could not find a matching project')
+        logger.info('could not find a matching project')
         return infos
 
     # this works for Metadata 1.2
@@ -359,7 +359,7 @@
     finally:
         shutil.rmtree(tmp)
 
-    logger.info('Removing %r...', project_name)
+    logger.info('removing %r...', project_name)
 
     file_count = 0
     for file_ in rmfiles:
@@ -392,20 +392,20 @@
     if os.path.exists(dist.path):
         shutil.rmtree(dist.path)
 
-    logger.info('Success! Removed %d files and %d dirs',
+    logger.info('success: removed %d files and %d dirs',
                 file_count, dir_count)
 
 
 def install(project):
-    logger.info('Getting information about "%s".', project)
+    logger.info('getting information about %r', project)
     try:
         info = get_infos(project)
     except InstallationException:
-        logger.info('Cound not find "%s".', project)
+        logger.info('cound not find %r', project)
         return
 
     if info['install'] == []:
-        logger.info('Nothing to install.')
+        logger.info('nothing to install')
         return
 
     install_path = get_config_var('base')
diff --git a/distutils2/tests/test_manifest.py b/distutils2/tests/test_manifest.py
--- a/distutils2/tests/test_manifest.py
+++ b/distutils2/tests/test_manifest.py
@@ -54,7 +54,7 @@
         # and 3 warnings issued (we ddidn't provided the files)
         self.assertEqual(len(warns), 3)
         for warn in warns:
-            self.assertIn('warning: no files found matching', warn)
+            self.assertIn('no files found matching', warn)
 
         # manifest also accepts file-like objects
         old_warn = logging.warning

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list