Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
agetpkg
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
archlinux
agetpkg
Commits
3b0abff6
Commit
3b0abff6
authored
Sep 10, 2020
by
Seblu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle overwrite of local files in Url class
parent
df88fb24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
agetpkg
agetpkg
+5
-8
No files found.
agetpkg
View file @
3b0abff6
...
...
@@ -102,8 +102,10 @@ class Url(object):
raise
Error
(
f
"Failed to get headers at
{
self
}
:
{
exp
}
"
)
return
getattr
(
self
,
"_headers"
)
def
download
(
self
,
destination
):
def
download
(
self
,
destination
,
overwrite
=
True
):
"""Download URL to destination"""
if
not
overwrite
and
exists
(
destination
):
raise
Error
(
f
"Local file
{
destination
}
already exists"
)
debug
(
f
"Downloading from :
{
self
.
url
}
"
)
debug
(
f
" to :
{
destination
}
"
)
try
:
...
...
@@ -154,14 +156,9 @@ class Package(Url):
def
get
(
self
,
sign
=
True
,
force
=
False
):
"""Download the package locally"""
if
not
force
:
if
exists
(
self
.
filename
):
raise
Error
(
f
"Local file
{
self
.
filename
}
already exists"
)
if
sign
and
exists
(
self
.
sigfilename
):
raise
Error
(
f
"Local file
{
self
.
sigfilename
}
already exists"
)
self
.
url
.
download
(
self
.
filename
)
self
.
url
.
download
(
self
.
filename
,
force
)
if
sign
and
self
.
sigurl
.
exists
:
self
.
sigurl
.
download
(
self
.
sigfilename
)
self
.
sigurl
.
download
(
self
.
sigfilename
,
force
)
class
Archive
(
object
):
"""Abstract access to the package Archive"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment