Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #1429: "pip install numpy scipy" was failing #453

Merged
merged 4 commits into from Feb 27, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
62 changes: 43 additions & 19 deletions setup.py
Expand Up @@ -88,18 +88,7 @@ def _minimal_ext_cmd(cmd):
# a lot more robust than what was previously being used.
builtins.__SCIPY_SETUP__ = True

def write_version_py(filename='scipy/version.py'):
cnt = """
# THIS FILE IS GENERATED FROM SCIPY SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
full_version = '%(full_version)s'
git_revision = '%(git_revision)s'
release = %(isrelease)s

if not release:
version = full_version
"""
def get_version_info():
# Adding the git rev number needs to be done inside
# write_version_py(), otherwise the import of scipy.version messes
# up the build under Python 3.
Expand All @@ -108,13 +97,33 @@ def write_version_py(filename='scipy/version.py'):
GIT_REVISION = git_version()
elif os.path.exists('scipy/version.py'):
# must be a source distribution, use existing version file
from scipy.version import git_revision as GIT_REVISION
# load it as a separate module to not load scipy/__init__.py
import imp
version = imp.load_source('scipy.version', 'scipy/version.py')
GIT_REVISION = version.git_revision
else:
GIT_REVISION = "Unknown"

if not ISRELEASED:
FULLVERSION += '.dev-' + GIT_REVISION[:7]

return FULLVERSION, GIT_REVISION


def write_version_py(filename='scipy/version.py'):
cnt = """
# THIS FILE IS GENERATED FROM SCIPY SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
full_version = '%(full_version)s'
git_revision = '%(git_revision)s'
release = %(isrelease)s

if not release:
version = full_version
"""
FULLVERSION, GIT_REVISION = get_version_info()

a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,
Expand Down Expand Up @@ -155,15 +164,11 @@ def configuration(parent_package='',top_path=None):


def setup_package():
from numpy.distutils.core import setup

# Rewrite the version file everytime
write_version_py()

# Generate Cython sources
generate_cython()

setup(
META_DATA = dict(
name = 'scipy',
maintainer = "SciPy Developers",
maintainer_email = "scipy-dev@scipy.org",
Expand All @@ -174,8 +179,27 @@ def setup_package():
license = 'BSD',
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
configuration=configuration)
)

# For actins line egg_info and --version NumPy is not required
if '--help' in sys.argv[1:] or \
sys.argv[1] in ('--help-commands', 'egg_info', '--version'):
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

FULLVERSION, GIT_REVISION = get_version_info()
META_DATA['version'] = FULLVERSION
else:
from numpy.distutils.core import setup

# Generate Cython sources
generate_cython()

META_DATA['configuration'] = configuration

setup(**META_DATA)

if __name__ == '__main__':
setup_package()
Expand Down