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
5367a739
Commit
5367a739
authored
Feb 11, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Override upload command to load passwords from keyring when available and not otherwise specified.
parent
0975916c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
1 deletion
+48
-1
CHANGES.txt
CHANGES.txt
+8
-0
docs/setuptools.txt
docs/setuptools.txt
+16
-0
setuptools/command/__init__.py
setuptools/command/__init__.py
+1
-1
setuptools/command/upload.py
setuptools/command/upload.py
+23
-0
No files found.
CHANGES.txt
View file @
5367a739
...
...
@@ -2,6 +2,14 @@
CHANGES
=======
20.1
----
Added support for using passwords from keyring in the upload
command. See `the upload docs
<http://pythonhosted.org/setuptools/setuptools.html#upload-upload-source-and-or-egg-distributions-to-pypi>`_
for details.
20.0
----
...
...
docs/setuptools.txt
View file @
5367a739
...
...
@@ -2332,6 +2332,22 @@ The ``upload`` command is implemented and `documented
<https://docs.python.org/3.1/distutils/uploading.html>`_
in distutils.
Setuptools augments the ``upload`` command with support
for `keyring <https://pypi.python.org/pypi/keyring>`_,
allowing the password to be stored in a secure
location and not in plaintext in the .pypirc file. To use
keyring, first install keyring and set the password for
the relevant repository, e.g.::
python -m keyring set <repository> <username>
Password for '<username>' in '<repository>': ********
Then, in .pypirc, set the repository configuration as normal,
but omit the password. Thereafter, uploads will use the
password from the keyring.
New in 20.1: Added keyring support.
.. _upload_docs:
``upload_docs`` - Upload package documentation to PyPI
...
...
setuptools/command/__init__.py
View file @
5367a739
...
...
@@ -2,7 +2,7 @@ __all__ = [
'alias'
,
'bdist_egg'
,
'bdist_rpm'
,
'build_ext'
,
'build_py'
,
'develop'
,
'easy_install'
,
'egg_info'
,
'install'
,
'install_lib'
,
'rotate'
,
'saveopts'
,
'sdist'
,
'setopt'
,
'test'
,
'install_egg_info'
,
'install_scripts'
,
'register'
,
'bdist_wininst'
,
'upload_docs'
,
'register'
,
'bdist_wininst'
,
'upload_docs'
,
'upload'
,
]
from
distutils.command.bdist
import
bdist
...
...
setuptools/command/upload.py
0 → 100644
View file @
5367a739
from
distutils.command
import
upload
as
orig
class
upload
(
orig
.
upload
):
"""
Override default upload behavior to look up password
in the keyring if available.
"""
def
finalize_options
(
self
):
orig
.
upload
.
finalize_options
(
self
)
self
.
password
or
self
.
_load_password_from_keyring
()
def
_load_password_from_keyring
(
self
):
"""
Attempt to load password from keyring. Suppress Exceptions.
"""
try
:
keyring
=
__import__
(
'keyring'
)
self
.
password
=
keyring
.
get_password
(
self
.
repository
,
self
.
username
)
except
Exception
:
pass
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