Alexis Metaireau  committed 97fbb2a Draft

In english, information is invariable (infos → info)

  • Participants
  • Parent commits d015f9e

Comments (0)

Files changed (8)

File distutils2/command/

         data = self.distribution.metadata.todict()
-        # extra upload infos
+        # extra upload info
         data[':action'] = 'file_upload'
         data['protcol_version'] = '1'
         data['content'] = (os.path.basename(filename), content)

File distutils2/

-__all__ = ['install_dists', 'install_from_infos', 'get_infos', 'remove',
+__all__ = ['install_dists', 'install_from_info', 'get_info', 'remove',
            'install', 'install_local_project']
     return installed_dists
-def install_from_infos(install_path=None, install=[], remove=[], conflicts=[],
+def install_from_info(install_path=None, install=[], remove=[], conflicts=[],
     """Install and remove the given distributions.
-    The function signature is made to be compatible with the one of get_infos.
+    The function signature is made to be compatible with the one of get_info.
     The aim of this script is to povide a way to install/remove what's asked,
     and to rollback if needed.
-def get_infos(requirements, index=None, installed=None, prefer_final=True):
+def get_info(requirements, index=None, installed=None, prefer_final=True):
     """Return the informations on what's going to be installed and upgraded.
     :param requirements: is a *string* containing the requirements for this
         logger.debug('Reading installed distributions')
         installed = list(get_distributions(use_egg_info=True))
-    infos = {'install': [], 'remove': [], 'conflict': []}
+    info = {'install': [], 'remove': [], 'conflict': []}
     # Is a compatible version of the project already installed ?
     predicate = get_version_predicate(requirements)
     found = False
         # if we already have something installed, check it matches the
         # requirements
         if predicate.match(installed_project.version):
-            return infos
+            return info
     if not found:
     if release is None:'Could not find a matching project')
-        return infos
+        return info
     metadata = release.fetch_metadata()
 "Missing dependencies found, retrieving metadata")
         # we have missing deps
         for dist in dists:
-            _update_infos(infos, get_infos(dist, index, installed))
+            _update_info(info, get_info(dist, index, installed))
-    # Fill in the infos
+    # Fill in the info
     existing = [d for d in installed if ==]
     if existing:
-        infos['remove'].append(existing[0])
-        infos['conflict'].extend(depgraph.reverse_list[existing[0]])
-    infos['install'].append(release)
-    return infos
+        info['remove'].append(existing[0])
+        info['conflict'].extend(depgraph.reverse_list[existing[0]])
+    info['install'].append(release)
+    return info
-def _update_infos(infos, new_infos):
+def _update_info(info, new_info):
     """extends the lists contained in the `info` dict with those contained
     in the `new_info` one
-    for key, value in infos.items():
-        if key in new_infos:
-            infos[key].extend(new_infos[key])
+    for key, value in info.items():
+        if key in new_info:
+            info[key].extend(new_info[key])
 def remove(project_name, paths=None, auto_confirm=True):'Getting information about %r...', project)
-        info = get_infos(project)
+        info = get_info(project)
     except InstallationException:'Cound not find %r', project)
         return False
     install_path = get_config_var('base')
-        install_from_infos(install_path,
+        install_from_info(install_path,
                            info['install'], info['remove'], info['conflict'])
     except InstallationConflict, e:

File distutils2/pypi/

     from distutils2._backport import hashlib
-__all__ = ['ReleaseInfo', 'DistInfo', 'ReleasesList', 'get_infos_from_url']
+__all__ = ['ReleaseInfo', 'DistInfo', 'ReleasesList', 'get_info_from_url']
 EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz .egg".split()
 MD5_HASH = re.compile(r'^.*#md5=([a-f0-9]+)$')
         # set the downloaded path to None by default. The goal here
         # is to not download distributions multiple times
         self.downloaded_location = None
-        # We store urls in dict, because we need to have a bit more infos
+        # We store urls in dict, because we need to have a bit more info
         # than the simple URL. It will be used later to find the good url to
         # use.
         # We have two _url* attributes: _url and urls. urls contains a list
         return '<%s>' % string
-def get_infos_from_url(url, probable_dist_name=None, is_external=True):
+def get_info_from_url(url, probable_dist_name=None, is_external=True):
     """Get useful informations from an URL.
     Return a dict of (name, version, url, hashtype, hash, is_external)

File distutils2/pypi/

 from distutils2.metadata import Metadata
 from distutils2.pypi.base import BaseClient
 from distutils2.pypi.dist import (ReleasesList, EXTENSIONS,
-                                  get_infos_from_url, MD5_HASH)
+                                  get_info_from_url, MD5_HASH)
 from distutils2.pypi.errors import (PackagingPyPIError, DownloadError,
                                     UnableToDownload, CantParseArchiveName,
                                     ReleaseNotFound, ProjectNotFound)
                             # it's a distribution, so create a dist object
-                                infos = get_infos_from_url(link, project_name,
+                                info = get_info_from_url(link, project_name,
                                             is_external=self.index_url not in url)
                             except CantParseArchiveName, e:
                                     "version has not been parsed: %s", e)
-                                self._register_release(release_info=infos)
+                                self._register_release(release_info=info)
                             if self._is_browsable(link) and follow_links:
                                 self._process_url(link, project_name,

File distutils2/pypi/

         Return a ReleaseInfo object, with distribution-related informations
         filled in.
-        url_infos = self.proxy.release_urls(project_name, version)
+        url_info = self.proxy.release_urls(project_name, version)
         project = self._get_project(project_name)
         if version not in project.get_versions():
             project.add_release(release=ReleaseInfo(project_name, version,
         release = project.get_release(version)
-        for info in url_infos:
+        for info in url_info:
             packagetype = info['packagetype']
-            dist_infos = {'url': info['url'],
+            dist_info = {'url': info['url'],
                           'hashval': info['md5_digest'],
                           'hashname': 'md5',
                           'is_external': False,
                           'python_version': info['python_version']}
-            release.add_distribution(packagetype, **dist_infos)
+            release.add_distribution(packagetype, **dist_info)
         return release
     def get_metadata(self, project_name, version):

File distutils2/tests/

         self.version = version
         self.hidden = hidden
-        # URL infos
+        # URL info
         self.url = url
         self.digest = digest
         self.downloads = downloads
         self.requires_external = requires_external
         self.requires_python = requires_python
-    def url_infos(self):
+    def url_info(self):
         return {
             'url': self.url,
             'packagetype': self.type,
                     and not d.hidden]
     def release_urls(self, package_name, version):
-        return [d.url_infos() for d in self._dists
+        return [d.url_info() for d in self._dists
                 if == package_name and d.version == version]
     def release_data(self, package_name, version):

File distutils2/tests/

              'url': archive_path},
         installed = get_installed_dists([('bacon', '0.1', [])])
-        output = install.get_infos("choxie", index=client,
+        output = install.get_info("choxie", index=client,
         # we don't have installed bacon as it's already installed system-wide
              'url': archive_path},
-        output = install.get_infos("choxie", index=client,
+        output = install.get_info("choxie", index=client,
                      installed=get_installed_dists([('bacon', '0.1', [])]))
         installed = [(, str(o.version)) for o in output['install']]
         # name, version, deps.
         already_installed = [('bacon', '0.1', []),
                              ('chicken', '1.1', ['bacon (0.1)'])]
-        output = install.get_infos(
+        output = install.get_info(
             'choxie', index=client,
         # exists.
         client = self._get_client(server)
-                          install.get_infos,
+                          install.get_info,
                           'unexisting project', index=client)
     def test_move_files(self):
         for f in [o[1] for o in output]:  # o[1] is the new place
-    def test_update_infos(self):
+    def test_update_info(self):
         tests = [[
             {'foo': ['foobar', 'foo', 'baz'], 'baz': ['foo', 'foo']},
             {'foo': ['additional_content', 'yeah'], 'baz': ['test', 'foo']},
         for dict1, dict2, expect in tests:
-            install._update_infos(dict1, dict2)
+            install._update_info(dict1, dict2)
             for key in expect:
                 self.assertEqual(expect[key], dict1[key])
                          "name = mypackage\n"
                          "version = 0.1.0\n"))
-        install.install_from_infos(dest, install=[dist])
+        install.install_from_info(dest, install=[dist])
         self.assertEqual(len(os.listdir(dest)), 1)
     def test_install_dists_rollback(self):
             install._install_dist = old_install_dist
-    def test_install_from_infos_conflict(self):
+    def test_install_from_info_conflict(self):
         # assert conflicts raise an exception
-            install.install_from_infos,
+            install.install_from_info,
-    def test_install_from_infos_remove_success(self):
+    def test_install_from_info_remove_success(self):
         old_install_dists = install.install_dists
         install.install_dists = lambda x, y=None: None
             dists = []
             for i in range(2):
-            install.install_from_infos(remove=dists)
+            install.install_from_info(remove=dists)
             # assert that the files have been removed
             for dist in dists:
             install.install_dists = old_install_dists
-    def test_install_from_infos_remove_rollback(self):
+    def test_install_from_info_remove_rollback(self):
         old_install_dist = install._install_dist
         old_uninstall = getattr(install, 'uninstall', None)
             to_install = [ToInstallDist(), ToInstallDist()]
             temp_dir = self.mkdtemp()
-            self.assertRaises(Exception, install.install_from_infos,
+            self.assertRaises(Exception, install.install_from_info,
                               install_path=temp_dir, install=to_install,
             # assert that the files are in the same place
             install._install_dist = old_install_dist
             install.uninstall = old_uninstall
-    def test_install_from_infos_install_succes(self):
+    def test_install_from_info_install_succes(self):
         old_install_dist = install._install_dist
         install._install_dist = MagicMock([])
             install_path = "my_install_path"
             to_install = [ToInstallDist(), ToInstallDist()]
-            install.install_from_infos(install_path, install=to_install)
+            install.install_from_info(install_path, install=to_install)
             for dist in to_install:

File distutils2/tests/

 import os
 from distutils2.version import VersionPredicate
 from distutils2.pypi.dist import (ReleaseInfo, ReleasesList, DistInfo,
-                                  split_archive_name, get_infos_from_url)
+                                  split_archive_name, get_info_from_url)
 from distutils2.pypi.errors import HashDoesNotMatch, UnsupportedHashName
 from distutils2._backport import shutil
         # should raise a KeyError
-    def test_get_infos_from_url(self):
+    def test_get_info_from_url(self):
         # Test that the the URLs are parsed the right way
         url_list = {
             'FooBar-1.1.0.tar.gz': {
         for url, attributes in url_list.items():
             # for each url
-            infos = get_infos_from_url("" + url)
+            info = get_info_from_url("" + url)
             for attribute, expected in attributes.items():
-                got = infos.get(attribute)
+                got = info.get(attribute)
                 if attribute == "version":
                     self.assertEqual("%s" % got, expected)