Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-loader-pypi
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
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Platform
Development
swh-loader-pypi
Commits
a2af496d
Verified
Commit
a2af496d
authored
6 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
*: Use less _ in prefix variable names
parent
0837698a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
swh/loader/pypi/client.py
+11
-11
11 additions, 11 deletions
swh/loader/pypi/client.py
swh/loader/pypi/loader.py
+6
-6
6 additions, 6 deletions
swh/loader/pypi/loader.py
with
17 additions
and
17 deletions
swh/loader/pypi/client.py
+
11
−
11
View file @
a2af496d
...
...
@@ -368,18 +368,18 @@ class PyPIProject:
return
[]
if
not
isinstance
(
release
,
list
):
release
=
[
release
]
_
releases
=
[]
for
_
rel
in
release
:
_
name
=
_
rel
[
'
filename
'
]
_
sha256
=
_
rel
[
'
digests
'
][
'
sha256
'
]
if
(
_
name
,
_
sha256
)
in
known_releases
:
releases
=
[]
for
rel
in
release
:
name
=
rel
[
'
filename
'
]
sha256
=
rel
[
'
digests
'
][
'
sha256
'
]
if
(
name
,
sha256
)
in
known_releases
:
logging
.
debug
(
'
artifact (%s, %s) already seen for release %s, skipping
'
%
(
# noqa
_
name
,
_
sha256
,
version
))
name
,
sha256
,
version
))
continue
if
_
rel
[
'
packagetype
'
]
!=
'
sdist
'
:
if
rel
[
'
packagetype
'
]
!=
'
sdist
'
:
continue
_
releases
.
append
(
_
rel
)
return
_
releases
releases
.
append
(
rel
)
return
releases
def
_cleanup_release_artifacts
(
self
,
archive_path
,
directory_path
):
"""
Clean intermediary files which no longer needs to be present.
...
...
@@ -407,7 +407,7 @@ class PyPIProject:
"""
for
release
in
releases
:
# flatten the metadata to ease reading
_
flatten
n
ed_release
=
{
flattened_release
=
{
'
name
'
:
version
,
'
message
'
:
release
.
get
(
'
comment_text
'
,
''
),
'
sha256
'
:
release
[
'
digests
'
][
'
sha256
'
],
...
...
@@ -419,7 +419,7 @@ class PyPIProject:
# fetch and write locally archives
yield
self
.
client
.
prepare_release_artifact
(
self
.
project
,
_
flatten
n
ed_release
)
self
.
project
,
flattened_release
)
def
releases
(
self
,
known_releases
):
"""
Fetch metadata/data per release (if new release artifact detected)
...
...
This diff is collapsed.
Click to expand it.
swh/loader/pypi/loader.py
+
6
−
6
View file @
a2af496d
...
...
@@ -135,22 +135,22 @@ class PyPILoader(SWHLoader):
"""
(override) Fetch and collect swh objects.
"""
_
last_snapshot
=
self
.
_last_snapshot
()
if
_
last_snapshot
:
self
.
_snapshot
=
_
last_snapshot
.
copy
()
_
known_releases
=
self
.
_known_releases
(
self
.
_snapshot
)
last_snapshot
=
self
.
_last_snapshot
()
if
last_snapshot
:
self
.
_snapshot
=
last_snapshot
.
copy
()
known_releases
=
self
.
_known_releases
(
self
.
_snapshot
)
else
:
self
.
_snapshot
=
{
'
branches
'
:
{}
}
_
known_releases
=
[]
known_releases
=
[]
self
.
_contents
=
[]
self
.
_directories
=
[]
self
.
_revisions
=
[]
for
release_info
,
author
,
release
,
dirpath
in
self
.
project
.
releases
(
_
known_releases
):
known_releases
):
dirpath
=
dirpath
.
encode
(
'
utf-8
'
)
directory
=
Directory
.
from_disk
(
path
=
dirpath
,
data
=
True
)
_objects
=
directory
.
collect
()
...
...
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