Skip to content

Commit a0a8088

Browse files
authored
Merge pull request #1026 from bsipocz/update-helpers-v2.0.3
Updating astropy-helpers to 2.0.3
2 parents 4042ea9 + 24017be commit a0a8088

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

ah_bootstrap.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
contains an option called ``auto_use`` with a value of ``True``, it will
2020
automatically call the main function of this module called
2121
`use_astropy_helpers` (see that function's docstring for full details).
22-
Otherwise no further action is taken (however,
23-
``ah_bootstrap.use_astropy_helpers`` may be called manually from within the
24-
setup.py script).
22+
Otherwise no further action is taken and by default the system-installed version
23+
of astropy-helpers will be used (however, ``ah_bootstrap.use_astropy_helpers``
24+
may be called manually from within the setup.py script).
25+
26+
This behavior can also be controlled using the ``--auto-use`` and
27+
``--no-auto-use`` command-line flags. For clarity, an alias for
28+
``--no-auto-use`` is ``--use-system-astropy-helpers``, and we recommend using
29+
the latter if needed.
2530
2631
Additional options in the ``[ah_boostrap]`` section of setup.cfg have the same
2732
names as the arguments to `use_astropy_helpers`, and can be used to configure
@@ -147,6 +152,11 @@
147152
DIST_NAME = 'astropy-helpers'
148153
PACKAGE_NAME = 'astropy_helpers'
149154

155+
if PY3:
156+
UPPER_VERSION_EXCLUSIVE = None
157+
else:
158+
UPPER_VERSION_EXCLUSIVE = '3'
159+
150160
# Defaults for other options
151161
DOWNLOAD_IF_NEEDED = True
152162
INDEX_URL = 'https://pypi.python.org/simple'
@@ -287,6 +297,18 @@ def parse_command_line(cls, argv=None):
287297
config['offline'] = True
288298
argv.remove('--offline')
289299

300+
if '--auto-use' in argv:
301+
config['auto_use'] = True
302+
argv.remove('--auto-use')
303+
304+
if '--no-auto-use' in argv:
305+
config['auto_use'] = False
306+
argv.remove('--no-auto-use')
307+
308+
if '--use-system-astropy-helpers' in argv:
309+
config['auto_use'] = False
310+
argv.remove('--use-system-astropy-helpers')
311+
290312
return config
291313

292314
def run(self):
@@ -501,7 +523,10 @@ def get_option_dict(self, command_name):
501523
if version:
502524
req = '{0}=={1}'.format(DIST_NAME, version)
503525
else:
504-
req = DIST_NAME
526+
if UPPER_VERSION_EXCLUSIVE is None:
527+
req = DIST_NAME
528+
else:
529+
req = '{0}<{1}'.format(DIST_NAME, UPPER_VERSION_EXCLUSIVE)
505530

506531
attrs = {'setup_requires': [req]}
507532

0 commit comments

Comments
 (0)