Skip to content

Commit

Permalink
BUG: setup.py: write version.py only after switching to Py3 build dir
Browse files Browse the repository at this point in the history
This prevents importing non-2to3'ed numpy in Python 3 build, if
numpy/version.py exists for some reason but .git does not (e.g building
multiple Numpy versions from same source tree).
  • Loading branch information
pv committed Nov 23, 2010
1 parent 12d0200 commit 0131218
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ def configuration(parent_package='',top_path=None):

def setup_package():

# Rewrite the version file everytime
write_version_py()

# Perform 2to3 if needed
local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
src_path = local_path
Expand All @@ -167,11 +164,14 @@ def setup_package():
if os.path.isfile(site_cfg):
shutil.copy(site_cfg, src_path)

# Run build
old_path = os.getcwd()
os.chdir(src_path)
sys.path.insert(0, src_path)

# Rewrite the version file everytime
write_version_py()

# Run build
from numpy.distutils.core import setup

try:
Expand Down

0 comments on commit 0131218

Please sign in to comment.