Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-lister
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Antoine R. Dumont
swh-lister
Commits
3f3f714c
Verified
Commit
3f3f714c
authored
5 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
cran.lister: Move helper function to the bottom of the file
parent
5b652b30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/lister/cran/lister.py
+26
-26
26 additions, 26 deletions
swh/lister/cran/lister.py
with
26 additions
and
26 deletions
swh/lister/cran/lister.py
+
26
−
26
View file @
3f3f714c
# Copyright (C) 2019 The Software Heritage developers
# Copyright (C) 2019
-2020
The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
...
...
@@ -19,31 +19,6 @@ from swh.scheduler.utils import create_task_dict
logger
=
logging
.
getLogger
(
__name__
)
def
read_cran_data
()
->
List
[
Mapping
[
str
,
str
]]:
"""
Execute r script to read cran listing.
"""
filepath
=
pkg_resources
.
resource_filename
(
'
swh.lister.cran
'
,
'
list_all_packages.R
'
)
logger
.
debug
(
'
script list-all-packages.R path: %s
'
,
filepath
)
response
=
subprocess
.
run
(
filepath
,
stdout
=
subprocess
.
PIPE
,
shell
=
False
)
return
json
.
loads
(
response
.
stdout
.
decode
(
'
utf-8
'
))
def
compute_package_url
(
repo
:
Mapping
[
str
,
str
])
->
str
:
"""
Compute the package url from the repo dict.
Args:
repo: dict with key
'
Package
'
,
'
Version
'
Returns:
the package url
"""
return
'
https://cran.r-project.org/src/contrib
'
\
'
/{Package}_{Version}.tar.gz
'
.
format
(
**
repo
)
class
CRANLister
(
SimpleLister
):
MODEL
=
CRANModel
LISTER_NAME
=
'
cran
'
...
...
@@ -130,3 +105,28 @@ class CRANLister(SimpleLister):
'
origin_url
'
:
project_url
,
'
origin_type
'
:
'
tar
'
,
}
def
read_cran_data
()
->
List
[
Mapping
[
str
,
str
]]:
"""
Execute r script to read cran listing.
"""
filepath
=
pkg_resources
.
resource_filename
(
'
swh.lister.cran
'
,
'
list_all_packages.R
'
)
logger
.
debug
(
'
script list-all-packages.R path: %s
'
,
filepath
)
response
=
subprocess
.
run
(
filepath
,
stdout
=
subprocess
.
PIPE
,
shell
=
False
)
return
json
.
loads
(
response
.
stdout
.
decode
(
'
utf-8
'
))
def
compute_package_url
(
repo
:
Mapping
[
str
,
str
])
->
str
:
"""
Compute the package url from the repo dict.
Args:
repo: dict with key
'
Package
'
,
'
Version
'
Returns:
the package url
"""
return
'
https://cran.r-project.org/src/contrib
'
\
'
/{Package}_{Version}.tar.gz
'
.
format
(
**
repo
)
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