Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #147 from embray/issue-147
Browse files Browse the repository at this point in the history
auto-upgrade can break when a previous install of a different package *also* auto-upgraded astropy-helpers
  • Loading branch information
embray committed Apr 2, 2015
2 parents 29ba4f3 + 90367d0 commit 87bceb0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ astropy-helpers Changelog
- Various fixes enabling the astropy-helpers Sphinx build command and
Sphinx extensions to work with Sphinx 1.3. [#148]

- More improvement to the ability to handle multiple versions of
astropy-helpers being imported in the same Python interpreter session
in the (somewhat rare) case of nested installs. [#147]


1.0.1 (2015-03-04)
------------------
Expand Down
26 changes: 13 additions & 13 deletions ah_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ def run(self):
strategies = ['local_directory', 'local_file', 'index']
dist = None

# First, remove any previously imported versions of astropy_helpers;
# this is necessary for nested installs where one package's installer
# is installing another package via setuptools.sandbox.run_setup, as in
# the case of setup_requires
for key in list(sys.modules):
try:
if key == PACKAGE_NAME or key.startswith(PACKAGE_NAME + '.'):
del sys.modules[key]
except AttributeError:
# Sometimes mysterious non-string things can turn up in
# sys.modules
continue

# Check to see if the path is a submodule
self.is_submodule = self._check_submodule()

Expand Down Expand Up @@ -311,19 +324,6 @@ def run(self):
# Note: Adding the dist to the global working set also activates it
# (makes it importable on sys.path) by default.

# But first, remove any previously imported versions of
# astropy_helpers; this is necessary for nested installs where one
# package's installer is installing another package via
# setuptools.sandbox.run_set, as in the case of setup_requires
for key in list(sys.modules):
try:
if key == PACKAGE_NAME or key.startswith(PACKAGE_NAME + '.'):
del sys.modules[key]
except AttributeError:
# Sometimes mysterious non-string things can turn up in
# sys.modules
continue

try:
pkg_resources.working_set.add(dist, replace=True)
except TypeError:
Expand Down

0 comments on commit 87bceb0

Please sign in to comment.