Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pip-deps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SCS
pip-deps
Commits
f6ba342c
Commit
f6ba342c
authored
4 years ago
by
Marek Chrastina
Browse files
Options
Downloads
Patches
Plain Diff
Fix requires-python
parent
c9326b03
No related branches found
No related tags found
No related merge requests found
Pipeline
#13061
failed
4 years ago
Stage: test
Stage: build
Stage: check
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pipdeps/pipdeps.py
+41
-28
41 additions, 28 deletions
pipdeps/pipdeps.py
with
41 additions
and
28 deletions
pipdeps/pipdeps.py
+
41
−
28
View file @
f6ba342c
...
...
@@ -341,40 +341,28 @@ def parse_metadata(metadata, extra):
arr
=
[]
if
metadata_version
and
\
packaging
.
version
.
Version
(
metadata_version
)
>=
packaging
.
version
.
Version
(
'
2.0
'
):
py_ver
=
"
,
"
.
join
([
line
.
replace
(
'
Requires-Python:
'
,
''
).
strip
()
\
for
line
in
metadata
if
re
.
search
(
r
'
^Requires-Python:
'
,
line
)])
py_ver
=
py_ver
.
split
(
'
,
'
)
print
py_ver
if
py_ver
:
for
sss
in
py_ver
:
if
sss
.
strip
():
print
sss
.
strip
()
print
packaging
.
specifiers
.
LegacySpecifier
(
sss
.
strip
())
print
is_in_specifiers
(
PY_VER
,
py_ver
)
arr
=
[]
lines
=
[
line
.
replace
(
'
Requires-Dist:
'
,
''
).
strip
()
\
for
line
in
metadata
if
re
.
search
(
r
'
^Requires-Dist:
'
,
line
)]
for
line
in
lines
:
data
=
pkginfo
(
str
(
line
),
req_extra
=
extra
,
repair
=
True
)
if
data
:
arr
.
append
(
pkginfo
(
str
(
line
),
req_extra
=
extra
,
repair
=
True
)
)
arr
.
append
(
data
)
return
arr
def
get_pkg_data
():
"""
Return package data
"""
packages_data
=
{}
# pylint: disable=protected-access
for
pkg
in
pip
.
_internal
.
utils
.
misc
.
get_installed_distributions
():
pkg_name
,
pkg_ver
,
_pkg_extra
=
pkginfo
(
str
(
pkg
))
rev
=
{
'
installed_version
'
:
pkg_ver
,
'
requires
'
:
[
pkginfo
(
str
(
dep
),
repair
=
True
)
for
dep
in
pkg
.
requires
()]}
packages_data
[
pkg_name
]
=
rev
packages_data
=
insert_extras
(
packages_data
)
packages_data
=
insert_availables
(
packages_data
)
packages_data
=
insert_news
(
packages_data
)
while
True
:
new_packages_data
=
new_packages
(
packages_data
)
if
not
new_packages_data
:
break
new_packages_data
=
insert_availables
(
new_packages_data
)
new_packages_data
=
insert_news
(
new_packages_data
)
packages_data
=
merge_two_dicts
(
packages_data
,
new_packages_data
)
check_new_extras
(
packages_data
)
return
packages_data
def
pkginfo
(
data
,
req_extra
=
None
,
repair
=
False
):
"""
Return parsed pkginfo
...
...
@@ -418,6 +406,31 @@ def pkginfo(data, req_extra=None, repair=False):
return
None
return
(
pkg_name
.
lower
(),
pkg_ver
,
pkg_extra
)
def
get_pkg_data
():
"""
Return package data
"""
packages_data
=
{}
# pylint: disable=protected-access
for
pkg
in
pip
.
_internal
.
utils
.
misc
.
get_installed_distributions
():
pkg_name
,
pkg_ver
,
_pkg_extra
=
pkginfo
(
str
(
pkg
))
rev
=
{
'
installed_version
'
:
pkg_ver
,
'
requires
'
:
[
pkginfo
(
str
(
dep
),
repair
=
True
)
for
dep
in
pkg
.
requires
()]}
packages_data
[
pkg_name
]
=
rev
packages_data
=
insert_extras
(
packages_data
)
packages_data
=
insert_availables
(
packages_data
)
packages_data
=
insert_news
(
packages_data
)
while
True
:
new_packages_data
=
new_packages
(
packages_data
)
if
not
new_packages_data
:
break
new_packages_data
=
insert_availables
(
new_packages_data
)
new_packages_data
=
insert_news
(
new_packages_data
)
packages_data
=
merge_two_dicts
(
packages_data
,
new_packages_data
)
check_new_extras
(
packages_data
)
return
packages_data
def
insert_extras
(
data
):
"""
Insert extras
...
...
@@ -474,8 +487,8 @@ def get_available_vers(package):
if
requires_python
:
requires_python
=
list
(
set
(
requires_python
))
if
len
(
packagetype
)
==
1
and
packagetype
[
0
]
==
'
bdist_wheel
'
and
len
(
python_version
)
==
1
:
py
t
_ver
=
re
.
search
(
r
"
^py([0-9])
"
,
python_version
[
0
])
if
py
t
_ver
is
not
None
and
not
is_in_specifiers
(
PY_VER
,
[
"
>= %s
"
%
py
t
_ver
.
group
(
1
)]):
py_ver
=
re
.
search
(
r
"
^py([0-9])
"
,
python_version
[
0
])
if
py_ver
is
not
None
and
not
is_in_specifiers
(
PY_VER
,
[
"
>= %s
"
%
py_ver
.
group
(
1
)]):
continue
if
is_version
(
release
)
and
is_in_specifiers
(
PY_VER
,
requires_python
):
versions
.
append
(
release
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment