From 68353cbc5adf261e9e89ed22e18c04f3825e863e Mon Sep 17 00:00:00 2001 From: socketubs Date: Tue, 12 Feb 2013 18:16:11 +0100 Subject: [PATCH 1/9] list command now show ascending ordered list --- pip/commands/list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip/commands/list.py b/pip/commands/list.py index 3fb9d5240..72abb246e 100644 --- a/pip/commands/list.py +++ b/pip/commands/list.py @@ -43,7 +43,6 @@ class ListCommand(Command): default=False, help='If in a virtualenv that has global access, do not list globally-installed packages.') - index_opts = make_option_group(index_group, self.parser) self.parser.insert_option_group(0, index_opts) @@ -121,6 +120,7 @@ class ListCommand(Command): self.output_package_listing(installed_packages) def output_package_listing(self, installed_packages): + installed_packages = sorted(installed_packages, key=lambda dist: dist.project_name.lower()) for dist in installed_packages: if dist_is_editable(dist): line = '%s (%s, %s)' % (dist.project_name, dist.version, dist.location) From 42919f9913020246d43c8ef73226650faaac268d Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Tue, 12 Feb 2013 23:23:40 +0200 Subject: [PATCH 2/9] manual sorting of commands and summaries commands.get_summaries() will now yield instead of returning a list. --- pip/commands/__init__.py | 41 +++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/pip/commands/__init__.py b/pip/commands/__init__.py index de02214ed..38d227c25 100644 --- a/pip/commands/__init__.py +++ b/pip/commands/__init__.py @@ -31,17 +31,33 @@ commands = { } -def get_summaries(ignore_hidden=True): - """Return a sorted list of (command name, command summary).""" - items = [] +commands_order = [ + InstallCommand, + UninstallCommand, + FreezeCommand, + ListCommand, + ShowCommand, + SearchCommand, + ZipCommand, + UnzipCommand, + BundleCommand, + HelpCommand, +] - for name, command_class in commands.items(): + +def get_summaries(ignore_hidden=True, ordered=True): + """Yields sorted (command name, command summary) tuples.""" + + if ordered: + cmditems = _sort_commands(commands, commands_order) + else: + cmditems = commands.items() + + for name, command_class in cmditems: if ignore_hidden and command_class.hidden: continue - items.append((name, command_class.summary)) - - return sorted(items) + yield (name, command_class.summary) def get_similar_commands(name): @@ -56,3 +72,14 @@ def get_similar_commands(name): guess = False return guess + + +def _sort_commands(cmddict, order): + def keyfn(key): + try: + return order.index(key[1]) + except ValueError: + # unordered items should come last + return 0xff + + return sorted(cmddict.items(), key=keyfn) From ba7bac0def9dc1948b0b79233647eeae2be0c44b Mon Sep 17 00:00:00 2001 From: Marcus Smith Date: Wed, 13 Feb 2013 10:19:11 -0800 Subject: [PATCH 3/9] update authors file --- AUTHORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.txt b/AUTHORS.txt index b5b3d61d1..7943ae993 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -18,6 +18,7 @@ David (d1b) Dmitry Gladkov Donald Stufft Francesco +Geoffrey Lehée Georgi Valkov Hugo Lopes Tavares Ian Bicking From 61ed2b49eb88f851e4bd0addf6b22975d5014f28 Mon Sep 17 00:00:00 2001 From: Marcus Smith Date: Wed, 13 Feb 2013 19:17:28 -0800 Subject: [PATCH 4/9] simpler, local --root test --- tests/test_basic.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index 8c696a357..760de0e6f 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -12,7 +12,7 @@ from pip.util import rmtree, find_command from pip.exceptions import BadCommand from tests.test_pip import (here, reset_env, run_pip, pyversion, mkdir, - src_folder, write_file) + src_folder, write_file, path_to_url) from tests.local_repos import local_checkout from tests.path import Path @@ -497,10 +497,13 @@ def test_install_package_with_root(): """ env = reset_env() root_dir = env.scratch_path/'root' - result = run_pip('install', '--root', root_dir, "--install-option=--home=''", - '--install-option=--install-lib=lib/python', "initools==0.1") - - assert Path('scratch')/'root'/'lib'/'python'/'initools' in result.files_created, str(result) + find_links = path_to_url(os.path.join(here, 'packages')) + result = run_pip('install', '--root', root_dir, '-f', find_links, '--no-index', 'simple==1.0') + normal_install_path = env.root_path / env.site_packages / 'simple-1.0-py%s.egg-info' % pyversion + #use distutils to change the root exactly how the --root option does it + from distutils.util import change_root + root_path = change_root(os.path.join(env.scratch, 'root'), normal_install_path) + assert root_path in result.files_created, str(result) def test_find_command_folder_in_path(): From 3ef5eaf5d3b4293acd3c2671046e12eddf799235 Mon Sep 17 00:00:00 2001 From: Marcus Smith Date: Wed, 13 Feb 2013 22:34:40 -0800 Subject: [PATCH 5/9] fix new travis git config errors --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 10fb71389..ca45ae6f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,8 @@ python: before_install: - sudo apt-get install subversion bzr mercurial - echo -e "[web]\ncacerts = /etc/ssl/certs/ca-certificates.crt" >> ~/.hgrc + - git config --global user.email "python-virtualenv@googlegroups.com" + - git config --global user.name "Pip" install: pip install nose virtualenv scripttest mock script: nosetests notifications: From 5ae29b6f61660c26ed611a4161c8c4b0a0b025de Mon Sep 17 00:00:00 2001 From: Jonas Nockert Date: Thu, 14 Feb 2013 20:28:27 +0100 Subject: [PATCH 6/9] Corrected a few typos --- docs/cookbook.txt | 4 ++-- docs/development.txt | 2 +- docs/logic.txt | 6 +++--- docs/make.bat | 2 +- docs/usage.txt | 2 +- pip/baseparser.py | 2 +- pip/req.py | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/cookbook.txt b/docs/cookbook.txt index 777b39e98..f7fe028c4 100644 --- a/docs/cookbook.txt +++ b/docs/cookbook.txt @@ -125,7 +125,7 @@ Ensuring Repeatability Three things are required to fully guarantee a repeatable installation using requirements files. -1. The requirements file was generated by ``pip freeze`` or you're sure it only contains requirements that specifiy a specific version. +1. The requirements file was generated by ``pip freeze`` or you're sure it only contains requirements that specify a specific version. 2. The installation is performed using :ref:`--no-deps `. This guarantees that only what is explicitly listed in the requirements file is installed. -3. The installation is performed against a index or find-links location that is guaranteed to *not* allow achives to be changed and updated without a version increase. +3. The installation is performed against an index or find-links location that is guaranteed to *not* allow archives to be changed and updated without a version increase. diff --git a/docs/development.txt b/docs/development.txt index 1292e9483..cf39f385e 100644 --- a/docs/development.txt +++ b/docs/development.txt @@ -7,7 +7,7 @@ Pull Requests Submit Pull Requests against the `develop` branch. -Provide a good description of what your doing and why. +Provide a good description of what you're doing and why. Provide tests that cover your changes and try to run the tests locally first. diff --git a/docs/logic.txt b/docs/logic.txt index 7c225b174..ec08d589e 100644 --- a/docs/logic.txt +++ b/docs/logic.txt @@ -68,7 +68,7 @@ pip requires a working VCS command on your path: git, hg, svn, or bzr. VCS projects can be installed in :ref:`editable mode ` (using the :ref:`--editable ` option) or not. -* For editable installs, the clone location by default is "/src/SomeProject" in virtual environments, and "/src/SomeProject" for global intalls. +* For editable installs, the clone location by default is "/src/SomeProject" in virtual environments, and "/src/SomeProject" for global installs. The :ref:`--src ` option can be used to modify this location. * For non-editable installs, the project is built locally in a temp dir and then installed normally. @@ -153,8 +153,8 @@ See the :ref:`pip install Examples`. Hash Verification ================= -PyPI provides a md5 hash of a package by having the link to the -package include a #md5=. +PyPI provides an md5 hash of a package by having the link to the +package include an #md5=. pip supports checking this, as well as any of the guaranteed hashlib algorithms (sha1, sha224, sha384, sha256, sha512, md5). diff --git a/docs/make.bat b/docs/make.bat index aa5c189fc..eebb21057 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -21,7 +21,7 @@ if "%1" == "help" ( echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project + echo. htmlhelp to make HTML files and an HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub diff --git a/docs/usage.txt b/docs/usage.txt index 83fb55956..9453235b6 100644 --- a/docs/usage.txt +++ b/docs/usage.txt @@ -72,7 +72,7 @@ Examples $ pip install --upgrade SomePackage -4) Install a local project in in "editable" mode. See the section on :ref:`Editable Installs `. +4) Install a local project in "editable" mode. See the section on :ref:`Editable Installs `. :: diff --git a/pip/baseparser.py b/pip/baseparser.py index 124d03413..6f2ee47b2 100644 --- a/pip/baseparser.py +++ b/pip/baseparser.py @@ -162,7 +162,7 @@ class ConfigOptionParser(CustomOptionParser): val = option.convert_value(key, val) except optparse.OptionValueError: e = sys.exc_info()[1] - print("An error occured during configuration: %s" % e) + print("An error occurred during configuration: %s" % e) sys.exit(3) defaults[option.dest] = val return defaults diff --git a/pip/req.py b/pip/req.py index 2c45928ca..9bf113c5f 100644 --- a/pip/req.py +++ b/pip/req.py @@ -305,7 +305,7 @@ exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec')) filenames = [f for f in filenames if f.endswith('.egg-info')] if not filenames: - raise InstallationError('No files/directores in %s (from %s)' % (base, filename)) + raise InstallationError('No files/directories in %s (from %s)' % (base, filename)) assert filenames, "No files/directories in %s (from %s)" % (base, filename) # if we have more than one match, we pick the toplevel one. This can @@ -849,7 +849,7 @@ class RequirementSet(object): else: if self.has_requirement(name): raise InstallationError( - 'Double requirement given: %s (aready in %s, name=%r)' + 'Double requirement given: %s (already in %s, name=%r)' % (install_req, self.get_requirement(name), name)) self.requirements[name] = install_req ## FIXME: what about other normalizations? E.g., _ vs. -? From 282c4cc8d391f7a1491e2a43365e49904817d098 Mon Sep 17 00:00:00 2001 From: Marcus Smith Date: Thu, 14 Feb 2013 14:06:40 -0800 Subject: [PATCH 7/9] update authors --- AUTHORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.txt b/AUTHORS.txt index 7943ae993..a69ffe33d 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -29,6 +29,7 @@ Jannis Leidel Jay Graves John-Scott Atlakson Jon Parise +Jonas Nockert Josh Bronson Kamal Bin Mustafa Kelsey Hightower From b3702b9075180fab98d3727c6f30b89e66f76992 Mon Sep 17 00:00:00 2001 From: Marcus Smith Date: Fri, 15 Feb 2013 15:10:39 -0800 Subject: [PATCH 8/9] mention PIP_CONFIG_FILE as a way use an alternate config file --- docs/configuration.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/configuration.txt b/docs/configuration.txt index ebbb027dc..aa5c45dab 100644 --- a/docs/configuration.txt +++ b/docs/configuration.txt @@ -15,6 +15,8 @@ platforms. * On Unix and Mac OS X the configuration file is: :file:`$HOME/.pip/pip.conf` * On Windows, the configuration file is: :file:`%HOME%\\pip\\pip.ini` +You can set a custom path location for the config file using the environment variable ``PIP_CONFIG_FILE``. + The names of the settings are derived from the long command line option, e.g. if you want to use a different package index (``--index-url``) and set the HTTP timeout (``--default-timeout``) to 60 seconds your config file would From ee44e13716cb8dad3b52f0ab222eb2c7ce107e48 Mon Sep 17 00:00:00 2001 From: Marcus Smith Date: Fri, 15 Feb 2013 16:13:52 -0800 Subject: [PATCH 9/9] switch to a mirror in test to get full pass --- tests/test_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index 760de0e6f..0fa51da70 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -99,7 +99,7 @@ def test_install_from_mirrors_with_specific_mirrors(): Test installing a package from a specific PyPI mirror. """ e = reset_env() - result = run_pip('install', '-vvv', '--use-mirrors', '--mirrors', "http://d.pypi.python.org/", '--no-index', 'INITools==0.2') + result = run_pip('install', '-vvv', '--use-mirrors', '--mirrors', "http://a.pypi.python.org/", '--no-index', 'INITools==0.2') egg_info_folder = e.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion initools_folder = e.site_packages / 'initools' assert egg_info_folder in result.files_created, str(result)