twine-1.5.0/0000755000076500000240000000000012477706277013600 5ustar icordascstaff00000000000000twine-1.5.0/AUTHORS0000644000076500000240000000064712477704567014657 0ustar icordascstaff00000000000000# A list of people who have contributed to twine in order of their first # contribution. # # Uses the format of ``Name (url)`` with the ``(url)`` # being optional. Donald Stufft (https://caremad.io/) Jannis Leidel Ralf Schmitt Ian Cordasco Marc Abramowitz (http://marc-abramowitz.com/) twine-1.5.0/docs/0000755000076500000240000000000012477706277014530 5ustar icordascstaff00000000000000twine-1.5.0/docs/_static/0000755000076500000240000000000012477706277016156 5ustar icordascstaff00000000000000twine-1.5.0/docs/_static/.empty0000644000076500000240000000005412437230656017301 0ustar icordascstaff00000000000000Empty file to force the creation of _static twine-1.5.0/docs/changelog.rst0000644000076500000240000000171612477705755017216 0ustar icordascstaff00000000000000:orphan: ========= Changelog ========= * :release:`1.5.0 <2015-03-10>` * :bug:`85` Display information about the version of setuptools installed * :bug:`61` Support deprecated pypirc file format * :feature:`29` Support commands not named "gpg" for signing * Add lower-limit to requests dependency * :release:`1.4.0 <2014-12-12>` * :bug:`28` Prevent ResourceWarning from being shown * :bug:`34` List registered commands in help text * :bug:`32` Use pkg_resources to load registered commands * :bug:`47` Fix issue uploading packages with ``_``\ s in the name * :bug:`26` Add support for uploading Windows installers * :bug:`65` Expand globs and check for existence of dists to upload * :feature:`13` Parse ~/.pypirc ourselves and use subprocess instead of the distutils.spawn module. * :feature:`6` Switch to a git style dispatching for the commands to enable simpler commands and programmatic invocation. * :release:`1.2.2 <2013-10-03>` twine-1.5.0/docs/conf.py0000664000076500000240000002061112441207643016011 0ustar icordascstaff00000000000000# -*- coding: utf-8 -*- # # twine documentation build configuration file, created by # sphinx-quickstart on Tue Aug 13 11:51:54 2013. # # This file is execfile()d with the current directory set to its containing # dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath(os.pardir)) import twine # -- General configuration ---------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ "sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.coverage", "sphinx.ext.viewcode", "releases", ] # 'releases' (changelog) settings releases_issue_uri = "https://github.com/pypa/twine/issues/%s" releases_release_uri = "https://github.com/pypa/twine/tree/%s" # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix of source filenames. source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = "index" # General information about the project. project = "twine" copyright = "2013, Donald Stufft and individual contributors" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = ".".join(twine.__version__.split(".")[:2]) # The full version, including alpha/beta/rc tags. release = twine.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all documents # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = "twinedoc" # -- Options for LaTeX output ------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]) latex_documents = [ ( "index", "twine.tex", "Twine Documentation", "Donald Stufft and individual contributors", "manual", ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output ------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ( "index", "twine", "twine Documentation", ["Donald Stufft", "Individual contributors"], 1, ), ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ----------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( "index", "twine", "twine Documentation", "Donald Stufft and individual contributors", "twine", "One line description of project.", "Miscellaneous", ), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {"http://docs.python.org/": None} twine-1.5.0/docs/index.rst0000644000076500000240000000064412437230656016362 0ustar icordascstaff00000000000000.. twine documentation master file, created by sphinx-quickstart on Tue Aug 13 11:51:54 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to twine's documentation! ================================= Contents: .. toctree:: :maxdepth: 2 Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` twine-1.5.0/docs/make.bat0000644000076500000240000001174612437230656016133 0ustar icordascstaff00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\twine.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\twine.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end twine-1.5.0/docs/Makefile0000644000076500000240000001267012437230656016163 0ustar icordascstaff00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/twine.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/twine.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/twine" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/twine" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." twine-1.5.0/LICENSE0000644000076500000240000002273612437230656014604 0ustar icordascstaff00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. twine-1.5.0/MANIFEST.in0000664000076500000240000000034612441207643015323 0ustar icordascstaff00000000000000include LICENSE include README.rst include AUTHORS recursive-include tests *.py recursive-include docs *.bat recursive-include docs *.empty recursive-include docs *.py recursive-include docs *.rst recursive-include docs Makefile twine-1.5.0/PKG-INFO0000644000076500000240000001405112477706277014676 0ustar icordascstaff00000000000000Metadata-Version: 1.1 Name: twine Version: 1.5.0 Summary: Collection of utilities for interacting with PyPI Home-page: https://github.com/pypa/twine Author: Donald Stufft and individual contributors Author-email: donald@stufft.io License: Apache License, Version 2.0 Description: twine ===== Twine is a utility for interacting `with PyPI `_. Currently it only supports uploading distributions. Why Should I Use This? ---------------------- The biggest reason to use twine is that it securely authenticates you to PyPI over HTTPS using a verified connection while ``python setup.py upload`` `uses HTTP and exposes your credentials `_. This means anytime you use it you expose your username and password to being sniffed. Twine uses only verified TLS to upload to PyPI protecting your credentials from theft. Secondly it allows you to precreate your distribution files. ``python setup.py upload`` only allows you to upload something that you've created in the same command invocation. This means that you cannot test the exact file you're going to upload to PyPI to ensure that it works before uploading it. Finally it allows you to pre-sign your files and pass the .asc files into the command line invocation (``twine upload twine-1.0.1.tar.gz twine-1.0.1.tar.gz.asc``). This enables you to be assured that you're typing your gpg passphrase into gpg itself and not anything else since *you* will be the one directly executing ``gpg --detach-sign -a ``. Features -------- - Verified HTTPS Connections - Uploading doesn't require executing setup.py - Uploading files that have already been created, allowing testing of distributions before release - Supports uploading any packaging format (including wheels). Installation ------------ .. code-block:: bash $ pip install twine Usage ----- 1. Create some distributions in the normal way: .. code-block:: bash $ python setup.py sdist bdist_wheel 2. Upload with twine: .. code-block:: bash $ twine upload dist/* 3. Done! Options ~~~~~~~ .. code-block:: bash $ twine upload -h usage: twine upload [-h] [-r REPOSITORY] [-s] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT] dist [dist ...] positional arguments: dist The distribution files to upload to the repository, may additionally contain a .asc file to include an existing signature with the file upload optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to upload the files to -s, --sign Sign files to upload using gpg -i IDENTITY, --identity IDENTITY GPG identity used to sign files -u USERNAME, --username USERNAME The username to authenticate to the repository as -p PASSWORD, --password PASSWORD The password to authenticate to the repository with -c COMMENT, --comment COMMENT The comment to include with the distribution file Resources --------- * `IRC `_ (``#pypa`` - irc.freenode.net) * `GitHub repository `_ Contributing ------------ 1. Fork the `repository `_ on GitHub. 2. Make a branch off of master and commit your changes to it. 3. Run the tests with ``tox`` - Either use ``tox`` to build against all supported Python versions (if you have them installed) or use ``tox -e py{version}`` to test against a specific version, e.g., ``tox -e py27`` or ``tox -e py34``. - Always run ``tox -e pep8`` 4. Ensure that your name is added to the end of the AUTHORS file using the format ``Name (url)``, where the ``(url)`` portion is optional. 5. Submit a Pull Request to the master branch on GitHub. If you'd like to have a development environment for twine, you should create a virtualenv and then do ``pip install -e .`` from within the directory. Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Natural Language :: English Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: POSIX Classifier: Operating System :: POSIX :: BSD Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy twine-1.5.0/README.rst0000644000076500000240000000761112456772056015267 0ustar icordascstaff00000000000000twine ===== Twine is a utility for interacting `with PyPI `_. Currently it only supports uploading distributions. Why Should I Use This? ---------------------- The biggest reason to use twine is that it securely authenticates you to PyPI over HTTPS using a verified connection while ``python setup.py upload`` `uses HTTP and exposes your credentials `_. This means anytime you use it you expose your username and password to being sniffed. Twine uses only verified TLS to upload to PyPI protecting your credentials from theft. Secondly it allows you to precreate your distribution files. ``python setup.py upload`` only allows you to upload something that you've created in the same command invocation. This means that you cannot test the exact file you're going to upload to PyPI to ensure that it works before uploading it. Finally it allows you to pre-sign your files and pass the .asc files into the command line invocation (``twine upload twine-1.0.1.tar.gz twine-1.0.1.tar.gz.asc``). This enables you to be assured that you're typing your gpg passphrase into gpg itself and not anything else since *you* will be the one directly executing ``gpg --detach-sign -a ``. Features -------- - Verified HTTPS Connections - Uploading doesn't require executing setup.py - Uploading files that have already been created, allowing testing of distributions before release - Supports uploading any packaging format (including wheels). Installation ------------ .. code-block:: bash $ pip install twine Usage ----- 1. Create some distributions in the normal way: .. code-block:: bash $ python setup.py sdist bdist_wheel 2. Upload with twine: .. code-block:: bash $ twine upload dist/* 3. Done! Options ~~~~~~~ .. code-block:: bash $ twine upload -h usage: twine upload [-h] [-r REPOSITORY] [-s] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT] dist [dist ...] positional arguments: dist The distribution files to upload to the repository, may additionally contain a .asc file to include an existing signature with the file upload optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to upload the files to -s, --sign Sign files to upload using gpg -i IDENTITY, --identity IDENTITY GPG identity used to sign files -u USERNAME, --username USERNAME The username to authenticate to the repository as -p PASSWORD, --password PASSWORD The password to authenticate to the repository with -c COMMENT, --comment COMMENT The comment to include with the distribution file Resources --------- * `IRC `_ (``#pypa`` - irc.freenode.net) * `GitHub repository `_ Contributing ------------ 1. Fork the `repository `_ on GitHub. 2. Make a branch off of master and commit your changes to it. 3. Run the tests with ``tox`` - Either use ``tox`` to build against all supported Python versions (if you have them installed) or use ``tox -e py{version}`` to test against a specific version, e.g., ``tox -e py27`` or ``tox -e py34``. - Always run ``tox -e pep8`` 4. Ensure that your name is added to the end of the AUTHORS file using the format ``Name (url)``, where the ``(url)`` portion is optional. 5. Submit a Pull Request to the master branch on GitHub. If you'd like to have a development environment for twine, you should create a virtualenv and then do ``pip install -e .`` from within the directory. twine-1.5.0/setup.cfg0000644000076500000240000000032712477706277015423 0ustar icordascstaff00000000000000[wheel] universal = 1 [check-manifest] ignore = .travis.yml tox.ini [metadata] requires-dist = requests pkginfo argparse; python_version == '2.6' [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 twine-1.5.0/setup.py0000644000076500000240000000435612452303575015305 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from setuptools import setup import sys import twine install_requires = [ "pkginfo", "requests >= 2.0", "setuptools >= 0.7.0", ] if sys.version_info[:2] < (2, 7): install_requires += [ "argparse", ] setup( name=twine.__title__, version=twine.__version__, description=twine.__summary__, long_description=open("README.rst").read(), license=twine.__license__, url=twine.__uri__, author=twine.__author__, author_email=twine.__email__, classifiers=[ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Operating System :: POSIX :: BSD", "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ], packages=["twine", "twine.commands"], entry_points={ "twine.registered_commands": [ "upload = twine.commands.upload:main", ], "console_scripts": [ "twine = twine.__main__:main", ], }, install_requires=install_requires, ) twine-1.5.0/tests/0000755000076500000240000000000012477706277014742 5ustar icordascstaff00000000000000twine-1.5.0/tests/test_cli.py0000644000076500000240000000221512442377205017105 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import pretend import pytest from twine import cli import twine.commands.upload def test_dispatch_to_subcommand(monkeypatch): replaced_main = pretend.call_recorder(lambda args: None) monkeypatch.setattr(twine.commands.upload, "main", replaced_main) cli.dispatch(["upload", "path/to/file"]) assert replaced_main.calls == [pretend.call(["path/to/file"])] def test_catches_enoent(): with pytest.raises(SystemExit): cli.dispatch(["non-existant-command"]) twine-1.5.0/tests/test_upload.py0000644000076500000240000000364212445624572017634 0ustar icordascstaff00000000000000# Copyright 2014 Ian Cordasco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pretend import pytest from twine.commands import upload def test_find_dists_expands_globs(): files = sorted(upload.find_dists(['twine/__*.py'])) expected = ['twine/__init__.py', 'twine/__main__.py'] assert expected == files def test_find_dists_errors_on_invalid_globs(): with pytest.raises(ValueError): upload.find_dists(['twine/*.rb']) def test_find_dists_handles_real_files(): expected = ['twine/__init__.py', 'twine/__main__.py', 'twine/cli.py', 'twine/utils.py', 'twine/wheel.py'] files = upload.find_dists(expected) assert expected == files def test_sign_file(monkeypatch): replaced_check_call = pretend.call_recorder(lambda args: None) monkeypatch.setattr(upload.subprocess, 'check_call', replaced_check_call) upload.sign_file('gpg2', 'my_file.tar.gz', None) args = ['gpg2', '--detach-sign', '-a', 'my_file.tar.gz'] assert replaced_check_call.calls == [pretend.call(args)] def test_sign_file_with_identity(monkeypatch): replaced_check_call = pretend.call_recorder(lambda args: None) monkeypatch.setattr(upload.subprocess, 'check_call', replaced_check_call) upload.sign_file('gpg', 'my_file.tar.gz', 'identity') args = ['gpg', '--detach-sign', '--local-user', 'identity', '-a', 'my_file.tar.gz'] assert replaced_check_call.calls == [pretend.call(args)] twine-1.5.0/tests/test_utils.py0000644000076500000240000000656412445624572017516 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import os.path import textwrap import pytest from twine.utils import DEFAULT_REPOSITORY, get_config, get_userpass_value def test_get_config(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") with open(pypirc, "w") as fp: fp.write(textwrap.dedent(""" [distutils] index-servers = pypi [pypi] username = testuser password = testpassword """)) assert get_config(pypirc) == { "pypi": { "repository": DEFAULT_REPOSITORY, "username": "testuser", "password": "testpassword", }, } def test_get_config_no_distutils(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") with open(pypirc, "w") as fp: fp.write(textwrap.dedent(""" [pypi] username = testuser password = testpassword """)) assert get_config(pypirc) == { "pypi": { "repository": DEFAULT_REPOSITORY, "username": "testuser", "password": "testpassword", }, } def test_get_config_no_section(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") with open(pypirc, "w") as fp: fp.write(textwrap.dedent(""" [distutils] index-servers = pypi foo [pypi] username = testuser password = testpassword """)) assert get_config(pypirc) == { "pypi": { "repository": DEFAULT_REPOSITORY, "username": "testuser", "password": "testpassword", }, } def test_get_config_missing(tmpdir): pypirc = os.path.join(str(tmpdir), ".pypirc") assert get_config(pypirc) == { "pypi": { "repository": DEFAULT_REPOSITORY, "username": None, "password": None, }, } def test_get_config_deprecated_pypirc(): tests_dir = os.path.dirname(os.path.abspath(__file__)) deprecated_pypirc_path = os.path.join(tests_dir, 'fixtures', 'deprecated-pypirc') assert get_config(deprecated_pypirc_path) == { "pypi": { "repository": DEFAULT_REPOSITORY, "username": 'testusername', "password": 'testpassword', }, } @pytest.mark.parametrize( ('cli_value', 'config', 'key', 'strategy', 'expected'), ( ('cli', {}, 'key', lambda: 'fallback', 'cli'), (None, {'key': 'value'}, 'key', lambda: 'fallback', 'value'), (None, {}, 'key', lambda: 'fallback', 'fallback'), ), ) def test_get_userpass_value(cli_value, config, key, strategy, expected): ret = get_userpass_value(cli_value, config, key, strategy) assert ret == expected twine-1.5.0/twine/0000755000076500000240000000000012477706277014726 5ustar icordascstaff00000000000000twine-1.5.0/twine/__init__.py0000644000076500000240000000217312477705770017037 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals __all__ = ( "__title__", "__summary__", "__uri__", "__version__", "__author__", "__email__", "__license__", "__copyright__", ) __title__ = "twine" __summary__ = "Collection of utilities for interacting with PyPI" __uri__ = "https://github.com/pypa/twine" __version__ = "1.5.0" __author__ = "Donald Stufft and individual contributors" __email__ = "donald@stufft.io" __license__ = "Apache License, Version 2.0" __copyright__ = "Copyright 2013 Donald Stufft" twine-1.5.0/twine/__main__.py0000644000076500000240000000151212437230656017004 0ustar icordascstaff00000000000000#!/usr/bin/env python # Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import sys from twine.cli import dispatch def main(): return dispatch(sys.argv[1:]) if __name__ == "__main__": sys.exit(main()) twine-1.5.0/twine/cli.py0000644000076500000240000000407612452303575016041 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import argparse import pkg_resources import setuptools import requests import pkginfo import twine def _registered_commands(group='twine.registered_commands'): return list(pkg_resources.iter_entry_points(group=group)) def dep_versions(): return 'pkginfo: {0}, requests: {1}, setuptools: {2}'.format( pkginfo.Installed(pkginfo).version, # __version__ is always defined but requests does not always have # PKG-INFO to read from requests.__version__, setuptools.__version__, ) def dispatch(argv): registered_commands = _registered_commands() parser = argparse.ArgumentParser(prog="twine") parser.add_argument( "--version", action="version", version="%(prog)s version {0} ({1})".format(twine.__version__, dep_versions()), ) parser.add_argument( "command", choices=[c.name for c in registered_commands], ) parser.add_argument( "args", help=argparse.SUPPRESS, nargs=argparse.REMAINDER, ) args = parser.parse_args(argv) command = args.command for registered_command in registered_commands: if registered_command.name == command: break else: print("{0} is not a valid command.".format(command)) raise SystemExit(True) main = registered_command.load() main(args.args) twine-1.5.0/twine/commands/0000755000076500000240000000000012477706277016527 5ustar icordascstaff00000000000000twine-1.5.0/twine/commands/__init__.py0000644000076500000240000000124612437230656020630 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals twine-1.5.0/twine/commands/upload.py0000644000076500000240000002050112452256115020343 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import argparse import glob import hashlib import os.path import subprocess import sys try: from urlparse import urlparse, urlunparse except ImportError: from urllib.parse import urlparse, urlunparse import pkginfo import pkg_resources import requests from twine.utils import get_config, get_username, get_password from twine.wheel import Wheel from twine.wininst import WinInst DIST_TYPES = { "bdist_wheel": Wheel, "bdist_wininst": WinInst, "bdist_egg": pkginfo.BDist, "sdist": pkginfo.SDist, } DIST_EXTENSIONS = { ".whl": "bdist_wheel", ".exe": "bdist_wininst", ".egg": "bdist_egg", ".tar.bz2": "sdist", ".tar.gz": "sdist", ".zip": "sdist", } def find_dists(dists): uploads = [] for filename in dists: if os.path.exists(filename): uploads.append(filename) continue # The filename didn't exist so it may be a glob files = glob.glob(filename) # If nothing matches, files is [] if not files: raise ValueError( "Cannot find file (or expand pattern): '%s'" % filename ) # Otherwise, files will be filenames that exist uploads.extend(files) return uploads def sign_file(sign_with, filename, identity): print("Signing {0}".format(os.path.basename(filename))) gpg_args = [sign_with, "--detach-sign", "-a", filename] if identity: gpg_args[2:2] = ["--local-user", identity] subprocess.check_call(gpg_args) def upload(dists, repository, sign, identity, username, password, comment, sign_with): # Check that a nonsensical option wasn't given if not sign and identity: raise ValueError("sign must be given along with identity") # Determine if the user has passed in pre-signed distributions signatures = dict( (os.path.basename(d), d) for d in dists if d.endswith(".asc") ) dists = [i for i in dists if not i.endswith(".asc")] # Get our config from ~/.pypirc try: config = get_config()[repository] except KeyError: raise KeyError( "Missing '{0}' section from the configuration file".format( repository, ), ) parsed = urlparse(config["repository"]) if parsed.netloc in ["pypi.python.org", "testpypi.python.org"]: config["repository"] = urlunparse( ("https",) + parsed[1:] ) print("Uploading distributions to {0}".format(config["repository"])) username = get_username(username, config) password = get_password(password, config) session = requests.session() uploads = find_dists(dists) for filename in uploads: # Sign the dist if requested if sign: sign_file(sign_with, filename, identity) # Extract the metadata from the package for ext, dtype in DIST_EXTENSIONS.items(): if filename.endswith(ext): meta = DIST_TYPES[dtype](filename) break else: raise ValueError( "Unknown distribution format: '%s'" % os.path.basename(filename) ) if dtype == "bdist_egg": pkgd = pkg_resources.Distribution.from_filename(filename) py_version = pkgd.py_version elif dtype == "bdist_wheel": py_version = meta.py_version elif dtype == "bdist_wininst": py_version = meta.py_version else: py_version = None # Fill in the data - send all the meta-data in case we need to # register a new release data = { # action ":action": "file_upload", "protcol_version": "1", # identify release "name": pkg_resources.safe_name(meta.name), "version": meta.version, # file content "filetype": dtype, "pyversion": py_version, # additional meta-data "metadata_version": meta.metadata_version, "summary": meta.summary, "home_page": meta.home_page, "author": meta.author, "author_email": meta.author_email, "maintainer": meta.maintainer, "maintainer_email": meta.maintainer_email, "license": meta.license, "description": meta.description, "keywords": meta.keywords, "platform": meta.platforms, "classifiers": meta.classifiers, "download_url": meta.download_url, "supported_platform": meta.supported_platforms, "comment": comment, # PEP 314 "provides": meta.provides, "requires": meta.requires, "obsoletes": meta.obsoletes, # Metadata 1.2 "project_urls": meta.project_urls, "provides_dist": meta.provides_dist, "obsoletes_dist": meta.obsoletes_dist, "requires_dist": meta.requires_dist, "requires_external": meta.requires_external, "requires_python": meta.requires_python, } with open(filename, "rb") as fp: content = fp.read() filedata = { "content": (os.path.basename(filename), content), } data["md5_digest"] = hashlib.md5(content).hexdigest() signed_name = os.path.basename(filename) + ".asc" if signed_name in signatures: with open(signatures[signed_name], "rb") as gpg: filedata["gpg_signature"] = (signed_name, gpg.read()) elif sign: with open(filename + ".asc", "rb") as gpg: filedata["gpg_signature"] = (signed_name, gpg.read()) print("Uploading {0}".format(os.path.basename(filename))) resp = session.post( config["repository"], data=dict((k, v) for k, v in data.items() if v), files=filedata, auth=(username, password), ) # Bug 28. Try to silence a ResourceWarning by releasing the socket and # clearing the connection pool. resp.close() session.close() resp.raise_for_status() def main(args): parser = argparse.ArgumentParser(prog="twine upload") parser.add_argument( "-r", "--repository", default="pypi", help="The repository to upload the files to (default: %(default)s)", ) parser.add_argument( "-s", "--sign", action="store_true", default=False, help="Sign files to upload using gpg", ) parser.add_argument( "--sign-with", default="gpg", help="GPG program used to sign uploads (default: %(default)s)", ) parser.add_argument( "-i", "--identity", help="GPG identity used to sign files", ) parser.add_argument( "-u", "--username", help="The username to authenticate to the repository as", ) parser.add_argument( "-p", "--password", help="The password to authenticate to the repository with", ) parser.add_argument( "-c", "--comment", help="The comment to include with the distribution file", ) parser.add_argument( "dists", nargs="+", metavar="dist", help="The distribution files to upload to the repository, may " "additionally contain a .asc file to include an existing " "signature with the file upload", ) args = parser.parse_args(args) # Call the upload function with the arguments from the command line try: upload(**vars(args)) except Exception as exc: sys.exit("{exc.__class__.__name__}: {exc}".format(exc=exc)) if __name__ == "__main__": sys.exit(main()) twine-1.5.0/twine/utils.py0000644000076500000240000000751112445624572016434 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import os.path import functools import getpass import sys try: import configparser except ImportError: # pragma: no cover import ConfigParser as configparser # Shim for raw_input in python3 if sys.version_info > (3,): input_func = input else: input_func = raw_input DEFAULT_REPOSITORY = "https://pypi.python.org/pypi" def get_config(path="~/.pypirc"): # Expand user strings in the path path = os.path.expanduser(path) if not os.path.isfile(path): return {"pypi": {"repository": DEFAULT_REPOSITORY, "username": None, "password": None } } # Parse the rc file parser = configparser.ConfigParser() parser.read(path) # Get a list of repositories from the config file if (parser.has_section("distutils") and parser.has_option("distutils", "index-servers")): repositories = parser.get("distutils", "index-servers").split() else: repositories = ["pypi"] config = {} defaults = {"username": None, "password": None} if parser.has_section("server-login"): for key in ["username", "password"]: if parser.has_option("server-login", key): defaults[key] = parser.get("server-login", key) for repository in repositories: # Skip this repository if it doesn't exist in the config file if not parser.has_section(repository): continue # Mandatory configuration and defaults config[repository] = { "repository": DEFAULT_REPOSITORY, "username": None, "password": None, } # Optional configuration values for key in ["username", "repository", "password"]: if parser.has_option(repository, key): config[repository][key] = parser.get(repository, key) elif defaults.get(key): config[repository][key] = defaults[key] return config def get_userpass_value(cli_value, config, key, prompt_strategy): """Gets the username / password from config. Uses the following rules: 1. If it is specified on the cli (`cli_value`), use that. 2. If `config[key]` is specified, use that. 3. Otherwise prompt using `prompt_strategy`. :param cli_value: The value supplied from the command line or `None`. :type cli_value: unicode or `None` :param config: Config dictionary :type config: dict :param key: Key to find the config value. :type key: unicode :prompt_strategy: Argumentless function to return fallback value. :type prompt_strategy: function :returns: The value for the username / password :rtype: unicode """ if cli_value is not None: return cli_value elif config.get(key): return config[key] else: return prompt_strategy() get_username = functools.partial( get_userpass_value, key='username', prompt_strategy=functools.partial(input_func, 'Enter your username: '), ) get_password = functools.partial( get_userpass_value, key='password', prompt_strategy=functools.partial( getpass.getpass, 'Enter your password: ', ), ) twine-1.5.0/twine/wheel.py0000644000076500000240000000523512437230656016376 0ustar icordascstaff00000000000000# Copyright 2013 Donald Stufft # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import os import re import zipfile try: from StringIO import StringIO except ImportError: from _io import StringIO from pkginfo import distribution from pkginfo.distribution import Distribution # Monkeypatch Metadata 2.0 support distribution.HEADER_ATTRS_2_0 = distribution.HEADER_ATTRS_1_2 distribution.HEADER_ATTRS.update({"2.0": distribution.HEADER_ATTRS_2_0}) wheel_file_re = re.compile( r"""^(?P(?P.+?)(-(?P\d.+?))?) ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?) \.whl|\.dist-info)$""", re.VERBOSE) class Wheel(Distribution): def __init__(self, filename, metadata_version=None): self.filename = filename self.metadata_version = metadata_version self.extractMetadata() @property def py_version(self): wheel_info = wheel_file_re.match(self.filename) return wheel_info.group("pyver") def read(self): fqn = os.path.abspath(os.path.normpath(self.filename)) if not os.path.exists(fqn): raise ValueError('No such file: %s' % fqn) if fqn.endswith('.whl'): archive = zipfile.ZipFile(fqn) names = archive.namelist() def read_file(name): return archive.read(name) else: raise ValueError('Not a known archive format: %s' % fqn) try: tuples = [x.split('/') for x in names if 'METADATA' in x] schwarz = sorted([(len(x), x) for x in tuples]) for path in [x[1] for x in schwarz]: candidate = '/'.join(path) data = read_file(candidate) if b'Metadata-Version' in data: return data finally: archive.close() raise ValueError('No METADATA in archive: %s' % fqn) def parse(self, data): super(Wheel, self).parse(data) fp = StringIO(distribution.must_decode(data)) msg = distribution.parse(fp) self.description = msg.get_payload() twine-1.5.0/twine/wininst.py0000644000076500000240000000313012441327177016755 0ustar icordascstaff00000000000000from __future__ import absolute_import, division, print_function from __future__ import unicode_literals import os import re import zipfile from pkginfo.distribution import Distribution wininst_file_re = re.compile(r".*py(?P\d+\.\d+)\.exe$") class WinInst(Distribution): def __init__(self, filename, metadata_version=None): self.filename = filename self.metadata_version = metadata_version self.extractMetadata() @property def py_version(self): m = wininst_file_re.match(self.filename) if m is None: return "any" else: return m.group("pyver") def read(self): fqn = os.path.abspath(os.path.normpath(self.filename)) if not os.path.exists(fqn): raise ValueError('No such file: %s' % fqn) if fqn.endswith('.exe'): archive = zipfile.ZipFile(fqn) names = archive.namelist() def read_file(name): return archive.read(name) else: raise ValueError('Not a known archive format: %s' % fqn) try: tuples = [x.split('/') for x in names if x.endswith(".egg-info") or x.endswith("PKG-INFO")] schwarz = sorted([(len(x), x) for x in tuples]) for path in [x[1] for x in schwarz]: candidate = '/'.join(path) data = read_file(candidate) if b'Metadata-Version' in data: return data finally: archive.close() raise ValueError('No PKG-INFO/.egg-info in archive: %s' % fqn) twine-1.5.0/twine.egg-info/0000755000076500000240000000000012477706277016420 5ustar icordascstaff00000000000000twine-1.5.0/twine.egg-info/dependency_links.txt0000644000076500000240000000000112477706277022466 0ustar icordascstaff00000000000000 twine-1.5.0/twine.egg-info/entry_points.txt0000644000076500000240000000016012477706277021713 0ustar icordascstaff00000000000000[console_scripts] twine = twine.__main__:main [twine.registered_commands] upload = twine.commands.upload:main twine-1.5.0/twine.egg-info/PKG-INFO0000644000076500000240000001405112477706277017516 0ustar icordascstaff00000000000000Metadata-Version: 1.1 Name: twine Version: 1.5.0 Summary: Collection of utilities for interacting with PyPI Home-page: https://github.com/pypa/twine Author: Donald Stufft and individual contributors Author-email: donald@stufft.io License: Apache License, Version 2.0 Description: twine ===== Twine is a utility for interacting `with PyPI `_. Currently it only supports uploading distributions. Why Should I Use This? ---------------------- The biggest reason to use twine is that it securely authenticates you to PyPI over HTTPS using a verified connection while ``python setup.py upload`` `uses HTTP and exposes your credentials `_. This means anytime you use it you expose your username and password to being sniffed. Twine uses only verified TLS to upload to PyPI protecting your credentials from theft. Secondly it allows you to precreate your distribution files. ``python setup.py upload`` only allows you to upload something that you've created in the same command invocation. This means that you cannot test the exact file you're going to upload to PyPI to ensure that it works before uploading it. Finally it allows you to pre-sign your files and pass the .asc files into the command line invocation (``twine upload twine-1.0.1.tar.gz twine-1.0.1.tar.gz.asc``). This enables you to be assured that you're typing your gpg passphrase into gpg itself and not anything else since *you* will be the one directly executing ``gpg --detach-sign -a ``. Features -------- - Verified HTTPS Connections - Uploading doesn't require executing setup.py - Uploading files that have already been created, allowing testing of distributions before release - Supports uploading any packaging format (including wheels). Installation ------------ .. code-block:: bash $ pip install twine Usage ----- 1. Create some distributions in the normal way: .. code-block:: bash $ python setup.py sdist bdist_wheel 2. Upload with twine: .. code-block:: bash $ twine upload dist/* 3. Done! Options ~~~~~~~ .. code-block:: bash $ twine upload -h usage: twine upload [-h] [-r REPOSITORY] [-s] [-i IDENTITY] [-u USERNAME] [-p PASSWORD] [-c COMMENT] dist [dist ...] positional arguments: dist The distribution files to upload to the repository, may additionally contain a .asc file to include an existing signature with the file upload optional arguments: -h, --help show this help message and exit -r REPOSITORY, --repository REPOSITORY The repository to upload the files to -s, --sign Sign files to upload using gpg -i IDENTITY, --identity IDENTITY GPG identity used to sign files -u USERNAME, --username USERNAME The username to authenticate to the repository as -p PASSWORD, --password PASSWORD The password to authenticate to the repository with -c COMMENT, --comment COMMENT The comment to include with the distribution file Resources --------- * `IRC `_ (``#pypa`` - irc.freenode.net) * `GitHub repository `_ Contributing ------------ 1. Fork the `repository `_ on GitHub. 2. Make a branch off of master and commit your changes to it. 3. Run the tests with ``tox`` - Either use ``tox`` to build against all supported Python versions (if you have them installed) or use ``tox -e py{version}`` to test against a specific version, e.g., ``tox -e py27`` or ``tox -e py34``. - Always run ``tox -e pep8`` 4. Ensure that your name is added to the end of the AUTHORS file using the format ``Name (url)``, where the ``(url)`` portion is optional. 5. Submit a Pull Request to the master branch on GitHub. If you'd like to have a development environment for twine, you should create a virtualenv and then do ``pip install -e .`` from within the directory. Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Natural Language :: English Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: POSIX Classifier: Operating System :: POSIX :: BSD Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy twine-1.5.0/twine.egg-info/requires.txt0000644000076500000240000000005312477706277021016 0ustar icordascstaff00000000000000pkginfo requests >= 2.0 setuptools >= 0.7.0twine-1.5.0/twine.egg-info/SOURCES.txt0000644000076500000240000000102712477706277020304 0ustar icordascstaff00000000000000AUTHORS LICENSE MANIFEST.in README.rst setup.cfg setup.py docs/Makefile docs/changelog.rst docs/conf.py docs/index.rst docs/make.bat docs/_static/.empty tests/test_cli.py tests/test_upload.py tests/test_utils.py twine/__init__.py twine/__main__.py twine/cli.py twine/utils.py twine/wheel.py twine/wininst.py twine.egg-info/PKG-INFO twine.egg-info/SOURCES.txt twine.egg-info/dependency_links.txt twine.egg-info/entry_points.txt twine.egg-info/requires.txt twine.egg-info/top_level.txt twine/commands/__init__.py twine/commands/upload.pytwine-1.5.0/twine.egg-info/top_level.txt0000644000076500000240000000000612477706277021146 0ustar icordascstaff00000000000000twine