Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
ae031502
Commit
ae031502
authored
Mar 22, 2005
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload GPG signature.
parent
a2e09746
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
command/upload.py
command/upload.py
+16
-3
No files found.
command/upload.py
View file @
ae031502
...
@@ -4,9 +4,10 @@ Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
...
@@ -4,9 +4,10 @@ Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
from
distutils.errors
import
*
from
distutils.errors
import
*
from
distutils.core
import
Command
from
distutils.core
import
Command
from
md5
import
md5
from
distutils.sysconfig
import
get_python_version
from
distutils.sysconfig
import
get_python_version
from
distutils.spawn
import
spawn
from
distutils
import
log
from
distutils
import
log
from
md5
import
md5
import
os
import
os
import
platform
import
platform
import
ConfigParser
import
ConfigParser
...
@@ -26,14 +27,17 @@ class upload(Command):
...
@@ -26,14 +27,17 @@ class upload(Command):
"url of repository [default: %s]"
%
DEFAULT_REPOSITORY
),
"url of repository [default: %s]"
%
DEFAULT_REPOSITORY
),
(
'show-response'
,
None
,
(
'show-response'
,
None
,
'display full response text from server'
),
'display full response text from server'
),
(
'sign'
,
's'
,
'sign files to upload using gpg'
),
]
]
boolean_options
=
[
'show-response'
]
boolean_options
=
[
'show-response'
,
'sign'
]
def
initialize_options
(
self
):
def
initialize_options
(
self
):
self
.
username
=
''
self
.
username
=
''
self
.
password
=
''
self
.
password
=
''
self
.
repository
=
''
self
.
repository
=
''
self
.
show_response
=
0
self
.
show_response
=
0
self
.
sign
=
False
def
finalize_options
(
self
):
def
finalize_options
(
self
):
if
os
.
environ
.
has_key
(
'HOME'
):
if
os
.
environ
.
has_key
(
'HOME'
):
...
@@ -61,11 +65,16 @@ class upload(Command):
...
@@ -61,11 +65,16 @@ class upload(Command):
self
.
upload_file
(
command
,
filename
)
self
.
upload_file
(
command
,
filename
)
def
upload_file
(
self
,
command
,
filename
):
def
upload_file
(
self
,
command
,
filename
):
# Sign if requested
if
self
.
sign
:
spawn
((
"gpg"
,
"--sign"
,
"-a"
,
filename
),
dry_run
=
self
.
dry_run
)
# Fill in the data
# Fill in the data
content
=
open
(
filename
).
read
()
content
=
open
(
filename
).
read
()
data
=
{
data
=
{
':action'
:
'file_upload'
,
':action'
:
'file_upload'
,
'protcol_version'
:
'1'
,
'name'
:
self
.
distribution
.
get_name
(),
'name'
:
self
.
distribution
.
get_name
(),
'version'
:
self
.
distribution
.
get_version
(),
'version'
:
self
.
distribution
.
get_version
(),
'content'
:(
os
.
path
.
basename
(
filename
),
content
),
'content'
:(
os
.
path
.
basename
(
filename
),
content
),
...
@@ -82,6 +91,10 @@ class upload(Command):
...
@@ -82,6 +91,10 @@ class upload(Command):
comment
=
'built for %s'
%
platform
.
platform
(
terse
=
1
)
comment
=
'built for %s'
%
platform
.
platform
(
terse
=
1
)
data
[
'comment'
]
=
comment
data
[
'comment'
]
=
comment
if
self
.
sign
:
data
[
'gpg_signature'
]
=
(
os
.
path
.
basename
(
filename
)
+
".asc"
,
open
(
filename
+
".asc"
).
read
())
# set up the authentication
# set up the authentication
auth
=
"Basic "
+
base64
.
encodestring
(
self
.
username
+
":"
+
self
.
password
).
strip
()
auth
=
"Basic "
+
base64
.
encodestring
(
self
.
username
+
":"
+
self
.
password
).
strip
()
...
@@ -148,7 +161,7 @@ class upload(Command):
...
@@ -148,7 +161,7 @@ class upload(Command):
log
.
INFO
)
log
.
INFO
)
else
:
else
:
self
.
announce
(
'Upload failed (%s): %s'
%
(
r
.
status
,
r
.
reason
),
self
.
announce
(
'Upload failed (%s): %s'
%
(
r
.
status
,
r
.
reason
),
log
.
INFO
)
log
.
ERROR
)
if
self
.
show_response
:
if
self
.
show_response
:
print
'-'
*
75
,
r
.
read
(),
'-'
*
75
print
'-'
*
75
,
r
.
read
(),
'-'
*
75
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