dependabot-python 0.113.18 → 0.113.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/helpers/build +2 -2
- data/helpers/install-dir/python/lib/__init__.py +0 -0
- data/helpers/install-dir/python/lib/hasher.py +23 -0
- data/helpers/install-dir/python/lib/parser.py +131 -0
- data/helpers/install-dir/python/requirements.txt +9 -0
- data/helpers/install-dir/python/run.py +18 -0
- data/helpers/requirements.txt +1 -1
- data/lib/dependabot/python/file_updater/pip_compile_file_updater.rb +2 -2
- data/lib/dependabot/python/file_updater/pipfile_file_updater.rb +1 -1
- data/lib/dependabot/python/python_versions.rb +3 -3
- data/lib/dependabot/python/update_checker/pip_compile_version_resolver.rb +2 -2
- data/lib/dependabot/python/update_checker/pipenv_version_resolver.rb +1 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20aabcdb4cc6f3a3a8cedf4f8052753e625c742f1a727f5d7ab6038791efb859
|
4
|
+
data.tar.gz: aaaa168d2f3f40969118516207838eb916a8d0eb9a44b7ef10c655ff2b8a7ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a7f0858879ec3d2af31d6d694ca3744c6b876355b184b583ee04d531572899fa73fa845df0f76d82bbd6e9498d0df095d3e83b2f92b72856eaae30d6d34261
|
7
|
+
data.tar.gz: 7a38cb19435f398f5ce2fa0d11b7750d6a66f78be2689a0920686721e516c8baa7dd3b77883b2a9915f955894e6c8d16ecafee943b00d0123bef92fd6975313d
|
data/helpers/build
CHANGED
@@ -16,5 +16,5 @@ cp -r \
|
|
16
16
|
"$install_dir"
|
17
17
|
|
18
18
|
cd "$install_dir"
|
19
|
-
PYENV_VERSION=2.7.
|
20
|
-
PYENV_VERSION=3.7.
|
19
|
+
PYENV_VERSION=2.7.17 pyenv exec pip install -r "requirements.txt"
|
20
|
+
PYENV_VERSION=3.7.5 pyenv exec pip install -r "requirements.txt"
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import hashin
|
2
|
+
import json
|
3
|
+
import pipfile
|
4
|
+
from poetry.poetry import Poetry
|
5
|
+
|
6
|
+
def get_dependency_hash(dependency_name, dependency_version, algorithm):
|
7
|
+
hashes = hashin.get_package_hashes(
|
8
|
+
dependency_name,
|
9
|
+
version=dependency_version,
|
10
|
+
algorithm=algorithm
|
11
|
+
)
|
12
|
+
|
13
|
+
return json.dumps({ "result": hashes["hashes"] })
|
14
|
+
|
15
|
+
def get_pipfile_hash(directory):
|
16
|
+
p = pipfile.load(directory + '/Pipfile')
|
17
|
+
|
18
|
+
return json.dumps({ "result": p.hash })
|
19
|
+
|
20
|
+
def get_pyproject_hash(directory):
|
21
|
+
p = Poetry.create(directory)
|
22
|
+
|
23
|
+
return json.dumps({ "result": p.locker._get_content_hash() })
|
@@ -0,0 +1,131 @@
|
|
1
|
+
from itertools import chain
|
2
|
+
import glob
|
3
|
+
import io
|
4
|
+
import json
|
5
|
+
import os.path
|
6
|
+
import re
|
7
|
+
|
8
|
+
import setuptools
|
9
|
+
import pip._internal.req.req_file
|
10
|
+
from pip._internal.download import PipSession
|
11
|
+
from pip._internal.req.constructors import install_req_from_line
|
12
|
+
|
13
|
+
def parse_requirements(directory):
|
14
|
+
# Parse the requirements.txt
|
15
|
+
requirement_packages = []
|
16
|
+
|
17
|
+
requirement_files = glob.glob(os.path.join(directory, '*.txt')) \
|
18
|
+
+ glob.glob(os.path.join(directory, '**', '*.txt'))
|
19
|
+
|
20
|
+
pip_compile_files = glob.glob(os.path.join(directory, '*.in')) \
|
21
|
+
+ glob.glob(os.path.join(directory, '**', '*.in'))
|
22
|
+
|
23
|
+
def version_from_install_req(install_req):
|
24
|
+
if install_req.is_pinned:
|
25
|
+
return next(iter(install_req.specifier)).version
|
26
|
+
|
27
|
+
for reqs_file in requirement_files + pip_compile_files:
|
28
|
+
try:
|
29
|
+
requirements = pip._internal.req.req_file.parse_requirements(
|
30
|
+
reqs_file,
|
31
|
+
session=PipSession()
|
32
|
+
)
|
33
|
+
for install_req in requirements:
|
34
|
+
if install_req.original_link:
|
35
|
+
continue
|
36
|
+
|
37
|
+
pattern = r"-[cr] (.*) \(line \d+\)"
|
38
|
+
abs_path = re.search(pattern, install_req.comes_from).group(1)
|
39
|
+
rel_path = os.path.relpath(abs_path, directory)
|
40
|
+
|
41
|
+
requirement_packages.append({
|
42
|
+
"name": install_req.req.name,
|
43
|
+
"version": version_from_install_req(install_req),
|
44
|
+
"markers": str(install_req.markers) or None,
|
45
|
+
"file": rel_path,
|
46
|
+
"requirement": str(install_req.specifier) or None
|
47
|
+
})
|
48
|
+
except Exception as e:
|
49
|
+
print(json.dumps({ "error": repr(e) }))
|
50
|
+
exit(1)
|
51
|
+
|
52
|
+
return json.dumps({ "result": requirement_packages })
|
53
|
+
|
54
|
+
def parse_setup(directory):
|
55
|
+
# Parse the setup.py
|
56
|
+
setup_packages = []
|
57
|
+
if os.path.isfile(directory + '/setup.py'):
|
58
|
+
def version_from_install_req(install_req):
|
59
|
+
if install_req.is_pinned:
|
60
|
+
return next(iter(install_req.specifier)).version
|
61
|
+
|
62
|
+
def parse_requirement(req, req_type):
|
63
|
+
install_req = install_req_from_line(req)
|
64
|
+
if install_req.original_link:
|
65
|
+
return
|
66
|
+
|
67
|
+
setup_packages.append({
|
68
|
+
"name": install_req.req.name,
|
69
|
+
"version": version_from_install_req(install_req),
|
70
|
+
"markers": str(install_req.markers) or None,
|
71
|
+
"file": "setup.py",
|
72
|
+
"requirement": str(install_req.specifier) or None,
|
73
|
+
"requirement_type": req_type
|
74
|
+
})
|
75
|
+
|
76
|
+
def setup(*args, **kwargs):
|
77
|
+
for arg in ['setup_requires', 'install_requires', 'tests_require']:
|
78
|
+
if not kwargs.get(arg):
|
79
|
+
continue
|
80
|
+
for req in kwargs.get(arg):
|
81
|
+
parse_requirement(req, arg)
|
82
|
+
extras_require_dict = kwargs.get('extras_require', {})
|
83
|
+
for key in extras_require_dict:
|
84
|
+
for req in extras_require_dict[key]:
|
85
|
+
parse_requirement(req, 'extras_require:{}'.format(key))
|
86
|
+
setuptools.setup = setup
|
87
|
+
|
88
|
+
def noop(*args, **kwargs):
|
89
|
+
pass
|
90
|
+
|
91
|
+
def fake_parse(*args, **kwargs):
|
92
|
+
return []
|
93
|
+
|
94
|
+
global fake_open
|
95
|
+
def fake_open(*args, **kwargs):
|
96
|
+
content = ("VERSION = ('0', '0', '1+dependabot')\n"
|
97
|
+
"__version__ = '0.0.1+dependabot'\n"
|
98
|
+
"__author__ = 'someone'\n"
|
99
|
+
"__title__ = 'something'\n"
|
100
|
+
"__description__ = 'something'\n"
|
101
|
+
"__author_email__ = 'something'\n"
|
102
|
+
"__license__ = 'something'\n"
|
103
|
+
"__url__ = 'something'\n")
|
104
|
+
return io.StringIO(content)
|
105
|
+
|
106
|
+
content = open(directory + '/setup.py', 'r').read()
|
107
|
+
|
108
|
+
# Remove `print`, `open`, `log` and import statements
|
109
|
+
content = re.sub(r"print\s*\(", "noop(", content)
|
110
|
+
content = re.sub(r"log\s*(\.\w+)*\(", "noop(", content)
|
111
|
+
content = re.sub(r"\b(\w+\.)*(open|file)\s*\(", "fake_open(", content)
|
112
|
+
content = content.replace("parse_requirements(", "fake_parse(")
|
113
|
+
version_re = re.compile(r"^.*import.*__version__.*$", re.MULTILINE)
|
114
|
+
content = re.sub(version_re, "", content)
|
115
|
+
|
116
|
+
# Set variables likely to be imported
|
117
|
+
__version__ = '0.0.1+dependabot'
|
118
|
+
__author__ = 'someone'
|
119
|
+
__title__ = 'something'
|
120
|
+
__description__ = 'something'
|
121
|
+
__author_email__ = 'something'
|
122
|
+
__license__ = 'something'
|
123
|
+
__url__ = 'something'
|
124
|
+
|
125
|
+
# Run as main (since setup.py is a script)
|
126
|
+
__name__ = '__main__'
|
127
|
+
|
128
|
+
# Exec the setup.py
|
129
|
+
exec(content) in globals(), locals()
|
130
|
+
|
131
|
+
return json.dumps({ "result": setup_packages })
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import sys
|
2
|
+
import json
|
3
|
+
|
4
|
+
from lib import parser, hasher
|
5
|
+
|
6
|
+
if __name__ == "__main__":
|
7
|
+
args = json.loads(sys.stdin.read())
|
8
|
+
|
9
|
+
if args["function"] == "parse_requirements":
|
10
|
+
print(parser.parse_requirements(args["args"][0]))
|
11
|
+
if args["function"] == "parse_setup":
|
12
|
+
print(parser.parse_setup(args["args"][0]))
|
13
|
+
elif args["function"] == "get_dependency_hash":
|
14
|
+
print(hasher.get_dependency_hash(*args["args"]))
|
15
|
+
elif args["function"] == "get_pipfile_hash":
|
16
|
+
print(hasher.get_pipfile_hash(*args["args"]))
|
17
|
+
elif args["function"] == "get_pyproject_hash":
|
18
|
+
print(hasher.get_pyproject_hash(*args["args"]))
|
data/helpers/requirements.txt
CHANGED
@@ -178,9 +178,9 @@ module Dependabot
|
|
178
178
|
|
179
179
|
raise relevant_error unless error_suggests_bad_python_version?(msg)
|
180
180
|
raise relevant_error if user_specified_python_version
|
181
|
-
raise relevant_error if python_version == "2.7.
|
181
|
+
raise relevant_error if python_version == "2.7.17"
|
182
182
|
|
183
|
-
@python_version = "2.7.
|
183
|
+
@python_version = "2.7.17"
|
184
184
|
retry
|
185
185
|
ensure
|
186
186
|
@python_version = nil
|
@@ -4,17 +4,17 @@ module Dependabot
|
|
4
4
|
module Python
|
5
5
|
module PythonVersions
|
6
6
|
PRE_INSTALLED_PYTHON_VERSIONS = %w(
|
7
|
-
3.7.
|
7
|
+
3.7.5 2.7.17
|
8
8
|
).freeze
|
9
9
|
|
10
10
|
# Due to an OpenSSL issue we can only install the following versions in
|
11
11
|
# the Dependabot container.
|
12
12
|
SUPPORTED_VERSIONS = %w(
|
13
13
|
3.8-dev
|
14
|
-
3.7.4 3.7.3 3.7.2 3.7.1 3.7.0
|
14
|
+
3.7.5 3.7.4 3.7.3 3.7.2 3.7.1 3.7.0
|
15
15
|
3.6.9 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.6.0
|
16
16
|
3.5.7 3.5.6 3.5.5 3.5.4 3.5.3
|
17
|
-
2.7.16 2.7.15 2.7.14 2.7.13
|
17
|
+
2.7.17 2.7.16 2.7.15 2.7.14 2.7.13
|
18
18
|
).freeze
|
19
19
|
|
20
20
|
# This list gets iterated through to find a valid version, so we have
|
@@ -234,9 +234,9 @@ module Dependabot
|
|
234
234
|
relevant_error = choose_relevant_error(original_err, e)
|
235
235
|
raise relevant_error unless error_suggests_bad_python_version?(msg)
|
236
236
|
raise relevant_error if user_specified_python_version
|
237
|
-
raise relevant_error if python_version == "2.7.
|
237
|
+
raise relevant_error if python_version == "2.7.17"
|
238
238
|
|
239
|
-
@python_version = "2.7.
|
239
|
+
@python_version = "2.7.17"
|
240
240
|
retry
|
241
241
|
ensure
|
242
242
|
@python_version = nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-python
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.113.
|
4
|
+
version: 0.113.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.113.
|
19
|
+
version: 0.113.19
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.113.
|
26
|
+
version: 0.113.19
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,6 +158,11 @@ extensions: []
|
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
160
|
- helpers/build
|
161
|
+
- helpers/install-dir/python/lib/__init__.py
|
162
|
+
- helpers/install-dir/python/lib/hasher.py
|
163
|
+
- helpers/install-dir/python/lib/parser.py
|
164
|
+
- helpers/install-dir/python/requirements.txt
|
165
|
+
- helpers/install-dir/python/run.py
|
161
166
|
- helpers/lib/__init__.py
|
162
167
|
- helpers/lib/hasher.py
|
163
168
|
- helpers/lib/parser.py
|