Skip to content

Commit d0dbd45

Browse files
authored
Merge pull request #1299 from bsipocz/update_helpers_2.0.8
Updating astropy_helpers to 2.0.8
2 parents d0a8e1f + 2d31ec0 commit d0dbd45

File tree

3 files changed

+15
-443
lines changed

3 files changed

+15
-443
lines changed

ah_bootstrap.py

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,20 @@
3838

3939
import contextlib
4040
import errno
41-
import imp
4241
import io
4342
import locale
4443
import os
4544
import re
4645
import subprocess as sp
4746
import sys
4847

48+
__minimum_python_version__ = (2, 7)
49+
50+
if sys.version_info < __minimum_python_version__:
51+
print("ERROR: Python {} or later is required by astropy-helpers".format(
52+
__minimum_python_version__))
53+
sys.exit(1)
54+
4955
try:
5056
from ConfigParser import ConfigParser, RawConfigParser
5157
except ImportError:
@@ -66,35 +72,15 @@
6672
# issues with either missing or misbehaving pacakges (including making sure
6773
# setuptools itself is installed):
6874

75+
# Check that setuptools 1.0 or later is present
76+
from distutils.version import LooseVersion
6977

70-
# Some pre-setuptools checks to ensure that either distribute or setuptools >=
71-
# 0.7 is used (over pre-distribute setuptools) if it is available on the path;
72-
# otherwise the latest setuptools will be downloaded and bootstrapped with
73-
# ``ez_setup.py``. This used to be included in a separate file called
74-
# setuptools_bootstrap.py; but it was combined into ah_bootstrap.py
7578
try:
76-
import pkg_resources
77-
_setuptools_req = pkg_resources.Requirement.parse('setuptools>=0.7')
78-
# This may raise a DistributionNotFound in which case no version of
79-
# setuptools or distribute is properly installed
80-
_setuptools = pkg_resources.get_distribution('setuptools')
81-
if _setuptools not in _setuptools_req:
82-
# Older version of setuptools; check if we have distribute; again if
83-
# this results in DistributionNotFound we want to give up
84-
_distribute = pkg_resources.get_distribution('distribute')
85-
if _setuptools != _distribute:
86-
# It's possible on some pathological systems to have an old version
87-
# of setuptools and distribute on sys.path simultaneously; make
88-
# sure distribute is the one that's used
89-
sys.path.insert(1, _distribute.location)
90-
_distribute.activate()
91-
imp.reload(pkg_resources)
92-
except:
93-
# There are several types of exceptions that can occur here; if all else
94-
# fails bootstrap and use the bootstrapped version
95-
from ez_setup import use_setuptools
96-
use_setuptools()
97-
79+
import setuptools
80+
assert LooseVersion(setuptools.__version__) >= LooseVersion('1.0')
81+
except (ImportError, AssertionError):
82+
print("ERROR: setuptools 1.0 or later is required by astropy-helpers")
83+
sys.exit(1)
9884

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

0 commit comments

Comments
 (0)