Skip to content

Commit

Permalink
Add Python3.10 to CI and handle distutils deprecation
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <[email protected]>
  • Loading branch information
gaborbernat committed Jul 14, 2021
1 parent eba921a commit 91dfd3e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
6 changes: 5 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
key: pre-commit | .pre-commit-config.yaml
path: $(PRE_COMMIT_HOME)
docs: null
py310:
image: [ linux ]
py39:
image: [ linux, windows, macOs ]
py38:
image: [linux, windows, macOs]
py27:
Expand All @@ -56,7 +60,7 @@ jobs:
package_description: null
coverage:
with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run
for_envs: [py38, py37, py36, py35, py27, pypy3, pypy]
for_envs: [py310, py39, py38, py37, py36, py35, py27, pypy3, pypy]
before:
- task: UsePythonVersion@0
condition: and(succeeded(), in(variables['TOXENV'], 'pypy'))
Expand Down
18 changes: 16 additions & 2 deletions src/tox/helper/get_site_package_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
import json
import sys
import sysconfig
import warnings

data = json.dumps({"dir": sysconfig.get_path("purelib", vars={"base": sys.argv[1]})})
print(data)
dest_prefix = sys.argv[1]
with warnings.catch_warnings(): # disable warning for PEP-632
warnings.simplefilter("ignore")
try:
import distutils.sysconfig

data = distutils.sysconfig.get_python_lib(prefix=dest_prefix)
except ImportError: # if removed or not installed ignore
config_vars = {
k: dest_prefix if any(v == p for p in (sys.prefix, sys.base_prefix)) else v
for k, v in sysconfig.get_config_vars().items()
}
data = sysconfig.get_path("purelib", vars=config_vars)

print(json.dumps({"dir": data}))
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ envlist = py27,
py36,
py37,
py38,
py39,
py310,
pypy,
pypy3,
coverage,
Expand Down Expand Up @@ -93,7 +95,7 @@ commands = coverage combine
coverage xml -o {toxworkdir}/coverage.xml
coverage html -d {toxworkdir}/htmlcov
diff-cover --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml
depends = py27, py34, py35, py36, py37, py38, pypy, pypy3
depends = py27, py35, py36, py37, py38, py39, py310, pypy, pypy3
parallel_show_output = True

[testenv:exit_code]
Expand Down

0 comments on commit 91dfd3e

Please sign in to comment.