Skip to content

Commit

Permalink
Tweak tox.ini to get it working well again
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-rhodes committed Feb 15, 2025
1 parent bc718b1 commit b3afb27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
import sgp4
description, long_description = sgp4.__doc__.split('\n', 1)

# Force compilation on Travis CI + Python 3 to make sure it keeps working.
optional = True
if sys.version_info[0] != 2 and os.environ.get('TRAVIS') == 'true':
optional = False

# It is hard to write C extensions that support both Python 2 and 3, so
# we opt here to support the acceleration only for Python 3.

ext_modules = []
if sys.version_info[0] == 3:

# This lets CI force us to exit with an error if compilation fails,
# instead of falling back silently to the backup Python code.
optional = True
if os.environ.get('SGP4_FORCE_COMPILE') == 'true':
optional = False

ext_modules.append(Extension(
'sgp4.vallado_cpp',
optional=optional,
Expand Down
13 changes: 4 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
[tox]
envlist = py27, py38
envlist = py27, py312

[testenv]
changedir = {envtmpdir}
deps =
numpy
whitelist_externals = python
commands = python -m unittest discover -b {posargs} sgp4

# Force the C++ to compile under Python 3, so that we really test the
# extension and not accidentally test the pure Python code over again
# (which is already tested under Python 2 in the env below).
setenv = TRAVIS = true

[testenv:py26]
deps =
numpy
unittest2
commands = python -m {envbindir}/unit2 discover {posargs} sgp4
# (which is already tested under Python 2).
setenv = SGP4_FORCE_COMPILE = true

0 comments on commit b3afb27

Please sign in to comment.