Skip to content

Commit

Permalink
Merge pull request #54 from bsipocz/update-helpers-v2.0.8
Browse files Browse the repository at this point in the history
Update astropy-helpers to v2.0.8
  • Loading branch information
matteobachetti committed Dec 14, 2018
2 parents 51a5256 + 61446a0 commit 79c85b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 443 deletions.
42 changes: 14 additions & 28 deletions ah_bootstrap.py
Expand Up @@ -38,14 +38,20 @@

import contextlib
import errno
import imp
import io
import locale
import os
import re
import subprocess as sp
import sys

__minimum_python_version__ = (2, 7)

if sys.version_info < __minimum_python_version__:
print("ERROR: Python {} or later is required by astropy-helpers".format(
__minimum_python_version__))
sys.exit(1)

try:
from ConfigParser import ConfigParser, RawConfigParser
except ImportError:
Expand All @@ -66,35 +72,15 @@
# issues with either missing or misbehaving pacakges (including making sure
# setuptools itself is installed):

# Check that setuptools 1.0 or later is present
from distutils.version import LooseVersion

# Some pre-setuptools checks to ensure that either distribute or setuptools >=
# 0.7 is used (over pre-distribute setuptools) if it is available on the path;
# otherwise the latest setuptools will be downloaded and bootstrapped with
# ``ez_setup.py``. This used to be included in a separate file called
# setuptools_bootstrap.py; but it was combined into ah_bootstrap.py
try:
import pkg_resources
_setuptools_req = pkg_resources.Requirement.parse('setuptools>=0.7')
# This may raise a DistributionNotFound in which case no version of
# setuptools or distribute is properly installed
_setuptools = pkg_resources.get_distribution('setuptools')
if _setuptools not in _setuptools_req:
# Older version of setuptools; check if we have distribute; again if
# this results in DistributionNotFound we want to give up
_distribute = pkg_resources.get_distribution('distribute')
if _setuptools != _distribute:
# It's possible on some pathological systems to have an old version
# of setuptools and distribute on sys.path simultaneously; make
# sure distribute is the one that's used
sys.path.insert(1, _distribute.location)
_distribute.activate()
imp.reload(pkg_resources)
except:
# There are several types of exceptions that can occur here; if all else
# fails bootstrap and use the bootstrapped version
from ez_setup import use_setuptools
use_setuptools()

import setuptools
assert LooseVersion(setuptools.__version__) >= LooseVersion('1.0')
except (ImportError, AssertionError):
print("ERROR: setuptools 1.0 or later is required by astropy-helpers")
sys.exit(1)

# typing as a dependency for 1.6.1+ Sphinx causes issues when imported after
# initializing submodule with ah_boostrap.py
Expand Down

0 comments on commit 79c85b2

Please sign in to comment.