diff options
| -rw-r--r-- | CHANGES.txt | 16 | ||||
| -rw-r--r-- | ez_setup.py | 27 | ||||
| -rwxr-xr-x | setuptools/command/easy_install.py | 9 |
3 files changed, 39 insertions, 13 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index f7c56b4a..608dd77d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,22 @@ CHANGES ======= +---- +14.0 +---- + +* Bootstrap script now accepts ``--to-dir`` to customize save directory or + allow for re-use of existing repository of setuptools versions. See + Pull Request #112 for an alternate implementation. +* Issue #285: ``easy_install`` no longer will default to installing + packages to the "user site packages" directory if it is itself installed + there. Instead, the user must pass ``--user`` in all cases to install + packages to the user site packages. + This behavior now matches that of "pip install". To configure + an environment to always install to the user site packages, consider + using the "install-dir" and "scripts-dir" parameters to easy_install + through an appropriate distutils config file. + ------ 13.0.2 ------ diff --git a/ez_setup.py b/ez_setup.py index d0af7948..9ece89d7 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -32,6 +32,7 @@ except ImportError: DEFAULT_VERSION = "13.0.2" DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/" +DEFAULT_SAVE_DIR = os.curdir def _python_cmd(*args): @@ -132,7 +133,7 @@ def _do_download(version, download_base, to_dir, download_delay): def use_setuptools( version=DEFAULT_VERSION, download_base=DEFAULT_URL, - to_dir=os.curdir, download_delay=15): + to_dir=DEFAULT_SAVE_DIR, download_delay=15): """ Ensure that a setuptools version is installed. @@ -306,7 +307,8 @@ def get_best_downloader(): def download_setuptools( version=DEFAULT_VERSION, download_base=DEFAULT_URL, - to_dir=os.curdir, delay=15, downloader_factory=get_best_downloader): + to_dir=DEFAULT_SAVE_DIR, delay=15, + downloader_factory=get_best_downloader): """ Download setuptools from a specified location and return its filename. @@ -359,19 +361,30 @@ def _parse_args(): '--version', help="Specify which version to download", default=DEFAULT_VERSION, ) + parser.add_option( + '--to-dir', + help="Directory to save (and re-use) package", + default=DEFAULT_SAVE_DIR, + ) options, args = parser.parse_args() # positional arguments are ignored return options +def _download_args(options): + """Return args for download_setuptools function from cmdline args.""" + return dict( + version=options.version, + download_base=options.download_base, + downloader_factory=options.downloader_factory, + to_dir=options.to_dir, + ) + + def main(): """Install or upgrade setuptools and EasyInstall.""" options = _parse_args() - archive = download_setuptools( - version=options.version, - download_base=options.download_base, - downloader_factory=options.downloader_factory, - ) + archive = download_setuptools(**_download_args(options)) return _install(archive, _build_install_args(options)) if __name__ == '__main__': diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index b039e2da..4e841520 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -152,12 +152,9 @@ class easy_install(Command): create_index = PackageIndex def initialize_options(self): - if site.ENABLE_USER_SITE: - whereami = os.path.abspath(__file__) - self.user = whereami.startswith(site.USER_SITE) - else: - self.user = 0 - + # the --user option seemst to be an opt-in one, + # so the default should be False. + self.user = 0 self.zip_ok = self.local_snapshots_ok = None self.install_dir = self.script_dir = self.exclude_scripts = None self.index_url = None |
