Skip to content

Commit 24c71b3

Browse files
authored
Merge pull request #114 from nexB/update-cache-location
Update cache location
2 parents 51dfcbc + ff417c7 commit 24c71b3

11 files changed

+47
-25
lines changed

CHANGELOG.rst

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
Changelog
22
=========
33

4+
next-version
5+
------------
6+
7+
- Create PyPI cache location in the home directory if a cache directory cannot be made at the project root.
8+
49

510
v0.9.3
611
------
712

813
- Add support for recursive requirements.
914
- Add python 3.11 as a valid python version in choices.
1015
- Operating system and python version are now required fields in CLI.
11-
- Add dot versions (3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 2.7) with
16+
- Add dot versions (3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 2.7) with
1217
current python version choices for CLI (36, 37, 38, 39, 310, 311, 27).
1318

1419

@@ -109,7 +114,7 @@ v0.6.3
109114
------
110115

111116
- Ensure to filter out top level dependencies on the basis of their environment markers
112-
- Do not ignore files on basis of name
117+
- Do not ignore files on basis of name
113118

114119

115120
v0.6.2
@@ -123,7 +128,7 @@ v0.6.1
123128
------
124129

125130
- Use latest ScanCode toolkit packagedcode including the ability to collect
126-
extra index URLs from requirements.txt
131+
extra index URLs from requirements.txt
127132
- Use new pipdeptree-like format for improved compatibility
128133
- Rename command line tool name from "dad" to "python-inspector"
129134

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ valid: isort black
3333
check:
3434
@echo "-> Run pycodestyle (PEP8) validation"
3535
@${ACTIVATE} pycodestyle --max-line-length=110 \
36-
--exclude=.eggs,etc/scripts,src/_packagedcode,venv,lib,thirdparty,docs .
36+
--exclude=.eggs,etc/scripts,src/_packagedcode,venv/,lib/,thirdparty/,docs/,.cache/ .
3737
@echo "-> Run isort imports ordering validation"
3838
@${ACTIVATE} isort --sl --check-only -l 100 setup.py src tests --skip-glob "*/_packagedcode/*"
3939
@echo "-> Run black validation"

azure-pipelines.yml

+18-11
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,54 @@ jobs:
1111
parameters:
1212
job_name: ubuntu18_cpython
1313
image_name: ubuntu-18.04
14-
python_versions: ['3.8', '3.9', '3.10']
14+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
1515
test_suites:
16-
all: |
17-
venv/bin/pytest -n 2 -vvs --reruns 2
16+
all: venv/bin/pytest -n 2 -vvs --reruns 2
1817

1918
- template: etc/ci/azure-posix.yml
2019
parameters:
2120
job_name: ubuntu20_cpython
2221
image_name: ubuntu-20.04
23-
python_versions: ['3.8', '3.9', '3.10']
22+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
2423
test_suites:
2524
all: venv/bin/pytest -n 2 -vvs --reruns 2
2625

2726
- template: etc/ci/azure-posix.yml
2827
parameters:
29-
job_name: macos12_cpython
30-
image_name: macos-12
31-
python_versions: ['3.8', '3.9', '3.10']
28+
job_name: ubuntu22_cpython
29+
image_name: ubuntu-22.04
30+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
3231
test_suites:
3332
all: venv/bin/pytest -n 2 -vvs --reruns 2
3433

3534
- template: etc/ci/azure-posix.yml
3635
parameters:
3736
job_name: macos11_cpython
3837
image_name: macos-11
39-
python_versions: ['3.8', '3.9', '3.10']
38+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
39+
test_suites:
40+
all: venv/bin/pytest -n 2 -vvs --reruns 2
41+
42+
- template: etc/ci/azure-posix.yml
43+
parameters:
44+
job_name: macos12_cpython
45+
image_name: macos-12
46+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
4047
test_suites:
4148
all: venv/bin/pytest -n 2 -vvs --reruns 2
4249

4350
- template: etc/ci/azure-win.yml
4451
parameters:
4552
job_name: win2019_cpython
4653
image_name: windows-2019
47-
python_versions: ['3.8', '3.9', '3.10']
54+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
4855
test_suites:
49-
all: venv\Scripts\pytest -n 2 -vvs --reruns 2
56+
all: venv\Scripts\pytest -n 2 -vvs --reruns 2
5057

5158
- template: etc/ci/azure-win.yml
5259
parameters:
5360
job_name: win2022_cpython
5461
image_name: windows-2022
55-
python_versions: ['3.8', '3.9', '3.10']
62+
python_versions: ['3.7', '3.8', '3.9', '3.10', '3.11']
5663
test_suites:
5764
all: venv\Scripts\pytest -n 2 -vvs --reruns 2

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ DOCS_REQUIREMENTS="--editable .[docs] --constraint requirements.txt"
3636
VIRTUALENV_DIR=venv
3737

3838
# Cleanable files and directories to delete with the --clean option
39-
CLEANABLE="build venv"
39+
CLEANABLE="build dist venv .cache .eggs"
4040

4141
# extra arguments passed to pip
4242
PIP_EXTRA_ARGS=" "

configure.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ set "DOCS_REQUIREMENTS=--editable .[docs] --constraint requirements.txt"
3434
set "VIRTUALENV_DIR=venv"
3535

3636
@rem # Cleanable files and directories to delete with the --clean option
37-
set "CLEANABLE=build venv"
37+
set "CLEANABLE=build dist venv .cache .eggs"
3838

3939
@rem # extra arguments passed to pip
4040
set "PIP_EXTRA_ARGS= "

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[tool.setuptools_scm]
66
# this is used populated when creating a git archive
77
# and when there is .git dir and/or there is no git installed
8-
fallback_version = "9999.$Format:%h-%cs$"
8+
fallback_version = "9999.9999.99"
99

1010
[tool.pytest.ini_options]
1111
norecursedirs = [

src/python_inspector/utils_pypi.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import email
1212
import itertools
1313
import os
14+
import pathlib
1415
import re
1516
import shutil
1617
import tempfile
@@ -174,7 +175,16 @@ def get_python_dot_version(version):
174175
],
175176
}
176177

177-
CACHE_THIRDPARTY_DIR = ".cache/thirdparty"
178+
CACHE_THIRDPARTY_DIR = os.environ.get("PYTHON_INSPECTOR_CACHE_DIR")
179+
if not CACHE_THIRDPARTY_DIR:
180+
CACHE_THIRDPARTY_DIR = ".cache/python_inspector"
181+
try:
182+
os.makedirs(CACHE_THIRDPARTY_DIR, exist_ok=True)
183+
except Exception:
184+
home = pathlib.Path.home()
185+
CACHE_THIRDPARTY_DIR = str(home / ".cache/python_inspector")
186+
os.makedirs(CACHE_THIRDPARTY_DIR, exist_ok=True)
187+
178188

179189
################################################################################
180190

tests/data/azure-devops.req-310-expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
55
"tool_version": "0.9.3",
66
"options": [
7-
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
7+
"--requirement /home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
88
"--index-url https://pypi.org/simple",
99
"--python-version 310",
1010
"--operating-system linux",
@@ -17,7 +17,7 @@
1717
"files": [
1818
{
1919
"type": "file",
20-
"path": "/home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
20+
"path": "/home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
2121
"package_data": [
2222
{
2323
"type": "pypi",

tests/data/azure-devops.req-38-expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"tool_homepageurl": "https://github.com/nexB/python-inspector",
55
"tool_version": "0.9.3",
66
"options": [
7-
"--requirement /home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
7+
"--requirement /home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
88
"--index-url https://pypi.org/simple",
99
"--python-version 38",
1010
"--operating-system linux",
@@ -17,7 +17,7 @@
1717
"files": [
1818
{
1919
"type": "file",
20-
"path": "/home/tg1999/Desktop/python-inspector-1/tests/data/azure-devops.req.txt",
20+
"path": "/home/jono/nexb/src/python-inspector/tests/data/azure-devops.req.txt",
2121
"package_data": [
2222
{
2323
"type": "pypi",

tests/data/insecure-setup-2/setup.py-expected.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"files": [
1717
{
1818
"type": "file",
19-
"path": "/home/tg1999/Desktop/python-inspector-1/tests/data/insecure-setup-2/setup.py",
19+
"path": "/home/jono/nexb/src/python-inspector/tests/data/insecure-setup-2/setup.py",
2020
"package_data": [
2121
{
2222
"type": "pypi",

tests/test_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
import pytest
1616
from commoncode.testcase import FileDrivenTesting
17+
from test_cli import check_json_results
1718

1819
from python_inspector.resolve_cli import resolver_api
19-
from tests.test_cli import check_json_results
2020

2121
test_env = FileDrivenTesting()
2222
test_env.test_data_dir = os.path.join(os.path.dirname(__file__), "data")

0 commit comments

Comments
 (0)