|
19 | 19 | contains an option called ``auto_use`` with a value of ``True``, it will |
20 | 20 | automatically call the main function of this module called |
21 | 21 | `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. |
25 | 30 |
|
26 | 31 | Additional options in the ``[ah_boostrap]`` section of setup.cfg have the same |
27 | 32 | names as the arguments to `use_astropy_helpers`, and can be used to configure |
|
147 | 152 | DIST_NAME = 'astropy-helpers' |
148 | 153 | PACKAGE_NAME = 'astropy_helpers' |
149 | 154 |
|
| 155 | +if PY3: |
| 156 | + UPPER_VERSION_EXCLUSIVE = None |
| 157 | +else: |
| 158 | + UPPER_VERSION_EXCLUSIVE = '3' |
| 159 | + |
150 | 160 | # Defaults for other options |
151 | 161 | DOWNLOAD_IF_NEEDED = True |
152 | 162 | INDEX_URL = 'https://pypi.python.org/simple' |
@@ -287,6 +297,18 @@ def parse_command_line(cls, argv=None): |
287 | 297 | config['offline'] = True |
288 | 298 | argv.remove('--offline') |
289 | 299 |
|
| 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 | + |
290 | 312 | return config |
291 | 313 |
|
292 | 314 | def run(self): |
@@ -501,7 +523,10 @@ def get_option_dict(self, command_name): |
501 | 523 | if version: |
502 | 524 | req = '{0}=={1}'.format(DIST_NAME, version) |
503 | 525 | 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) |
505 | 530 |
|
506 | 531 | attrs = {'setup_requires': [req]} |
507 | 532 |
|
|
0 commit comments