[Python-modules-commits] [python-pkginfo] 01/12: Import python-pkginfo_1.2.1.orig.tar.gz
Jan Dittberner
jandd at moszumanska.debian.org
Wed Dec 30 18:16:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
jandd pushed a commit to branch master
in repository python-pkginfo.
commit 4ef9f9e718734de0e0d58f2759fc0586784afda7
Author: Jan Dittberner <jandd at debian.org>
Date: Wed Dec 30 16:47:36 2015 +0100
Import python-pkginfo_1.2.1.orig.tar.gz
---
.bzrignore | 2 -
CHANGES.txt | 61 +++--
PKG-INFO | 66 +++--
docs/conf.py | 8 +-
docs/distributions.rst | 14 +
.../mypackage-0.1-cp26-none-linux_x86_64.whl | Bin 0 -> 1816 bytes
docs/examples/nodistinfo-0.1-any.whl | Bin 0 -> 955 bytes
docs/index.rst | 8 +-
pkginfo.egg-info/PKG-INFO | 66 +++--
pkginfo.egg-info/SOURCES.txt | 5 +
pkginfo.egg-info/requires.txt | 3 +-
pkginfo/__init__.py | 1 +
pkginfo/commandline.py | 24 +-
pkginfo/distribution.py | 3 +
pkginfo/tests/test_commandline.py | 294 +++++++++++++++++++++
pkginfo/tests/test_distribution.py | 16 ++
pkginfo/tests/test_installed.py | 36 +--
pkginfo/tests/test_utils.py | 19 ++
pkginfo/tests/test_wheel.py | 64 +++++
pkginfo/utils.py | 6 +
pkginfo/wheel.py | 49 ++++
setup.cfg | 8 +-
setup.py | 3 +-
tox.ini | 2 +-
24 files changed, 639 insertions(+), 119 deletions(-)
diff --git a/.bzrignore b/.bzrignore
index a5bb024..ceb3376 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1,6 +1,4 @@
*.egg-info
-./docs/.build/html
-./docs/.build/doctrees
./build
./dist
.coverage
diff --git a/CHANGES.txt b/CHANGES.txt
index 73d17a2..a734055 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,25 @@
``pkginfo`` Changelog
=====================
+1.2.1 (2014-01-02)
+------------------
+
+- Add overlooked Trove classifier for Python 3.4.
+
+1.2 (2014-01-02)
+----------------
+
+- Add support for Python 3.4, PyPy3.
+
+- Add 100% coverage for ``pkginfo.commandline`` module.
+
+1.2b1 (2013-12-05)
+------------------
+
+- Add support for the "wheel" distribution format, along with minimal
+ metadata 2.0 support (not including new PEP 426 JSON properties).
+ Code (re-)borrowed from Donald Stuft's ``twine`` package.
+
1.1 (2013-10-09)
----------------
@@ -64,7 +83,7 @@
- Work around Python 2.7's breakage of StringIO. Fixes
https://bugs.launchpad.net/pkginfo/+bug/733827
-- Fixed bug in introspection of installed packages missing the
+- Fix bug in introspection of installed packages missing the
``__package__`` attribute.
@@ -80,20 +99,20 @@
0.6 (2010-06-01)
----------------
-- Replaced use of ``StringIO.StringIO`` with ``io.StringIO``, where available
+- Replace use of ``StringIO.StringIO`` with ``io.StringIO``, where available
(Python >= 2.6).
-- Replaced use of ``rfc822`` stdlib module with ``email.parser``, when
+- Replace use of ``rfc822`` stdlib module with ``email.parser``, when
available (Python >= 2.5). Ensured that distributions "unfold" wrapped
continuation lines, stripping any leading / trailing whitespace, no matter
which module was used for parsing.
-- Removed bogus testing dependency on ``zope.testing``.
+- Remove bogus testing dependency on ``zope.testing``.
-- Added tests that the "environment markers" spelled out in the approved
+- Add tests that the "environment markers" spelled out in the approved
PEP 345 are captured.
-- Added ``Project-URL`` for ``1.2`` PKG-INFO metdata (defined in the accepted
+- Add ``Project-URL`` for ``1.2`` PKG-INFO metdata (defined in the accepted
version of PEP 345).
@@ -102,16 +121,16 @@
- Marked package as non-zip-safe.
-- Fixed Trove metadata misspelling.
+- Fix Trove metadata misspelling.
-- Restored compatibility with Python 2.4.
+- Restore compatibility with Python 2.4.
-- Noted that the introspection of installed packages / modules works only
+- Note that the introspection of installed packages / modules works only
in Python 2.6 or later.
-- Added ``Index`` class as an abstraction over a collection of distributions.
+- Add ``Index`` class as an abstraction over a collection of distributions.
-- Added ``download_url_prefix`` argument to ``pkginfo`` script. If passed,
+- Add ``download_url_prefix`` argument to ``pkginfo`` script. If passed,
the script will use the prefix to synthesize a ``download_url`` for
distributions which do not supply that value directly.
@@ -119,18 +138,18 @@
0.4.1 (2009-05-07)
------------------
-- Fixed bugs in handling of installed packages which lack ``__file__``
+- Fix bugs in handling of installed packages which lack ``__file__``
or ``PKG-INFO``.
0.4 (2009-05-07)
----------------
-- Extended the console script to allow output as CSV or INI. Also, added
+- Extend the console script to allow output as CSV or INI. Also, added
arguments to specify the metadata version and other parsing / output
policies.
-- Added support for the different metadata versions specified in PEPs
+- Add support for the different metadata versions specified in PEPs
241, 314, and 345. Distributions now parse and expose only the attributes
corresponding to their metadata version, which defaults to the version
parsed from the ``PKG-INFO`` file. The programmer can override that version
@@ -140,34 +159,34 @@
0.3 (2009-05-07)
----------------
-- Added support for introspection of "development eggs" (checkouts with
+- Add support for introspection of "development eggs" (checkouts with
``PKG-INFO``, perhaps created via ``setup.py develop``).
-- Added a console script, ``pkginfo``, which takes one or more paths
+- Add a console script, ``pkginfo``, which takes one or more paths
on the command line and writes out the associated information. Thanks
to ``runeh`` for the patch!
-- Added ``get_metadata`` helper function, which dispatches a given path or
+- Add ``get_metadata`` helper function, which dispatches a given path or
module across the available distribution types, and returns a distribution
object. Thanks to ``runeh`` for the patch!
-- Made distribution objects support iteration over the metadata fields.
+- Make distribution objects support iteration over the metadata fields.
Thanks to ``runeh`` for the patch!
-- Made Distribution and subclasses new-style classes. Thanks to ``runeh``
+- Make ``Distribution`` and subclasses new-style classes. Thanks to ``runeh``
for the patch!
0.2 (2009-04-14)
----------------
-- Added support for introspection of ``bdist_egg`` binary distributions.
+- Add support for introspection of ``bdist_egg`` binary distributions.
0.1.1 (2009-04-10)
------------------
-- Fixed packaging errors.
+- Fix packaging errors.
0.1 (2009-04-10)
diff --git a/PKG-INFO b/PKG-INFO
index 81901b5..92eab81 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: pkginfo
-Version: 1.1
+Version: 1.2.1
Summary: Query metadatdata from sdists / bdists / installed packages.
Home-page: http://pypi.python.org/pypi/pkginfo/
Author: Tres Seaver, Agendaless Consulting
@@ -24,6 +24,25 @@ Description: ``pkginfo`` README
``pkginfo`` Changelog
=====================
+ 1.2.1 (2014-01-02)
+ ------------------
+
+ - Add overlooked Trove classifier for Python 3.4.
+
+ 1.2 (2014-01-02)
+ ----------------
+
+ - Add support for Python 3.4, PyPy3.
+
+ - Add 100% coverage for ``pkginfo.commandline`` module.
+
+ 1.2b1 (2013-12-05)
+ ------------------
+
+ - Add support for the "wheel" distribution format, along with minimal
+ metadata 2.0 support (not including new PEP 426 JSON properties).
+ Code (re-)borrowed from Donald Stuft's ``twine`` package.
+
1.1 (2013-10-09)
----------------
@@ -87,7 +106,7 @@ Description: ``pkginfo`` README
- Work around Python 2.7's breakage of StringIO. Fixes
https://bugs.launchpad.net/pkginfo/+bug/733827
- - Fixed bug in introspection of installed packages missing the
+ - Fix bug in introspection of installed packages missing the
``__package__`` attribute.
@@ -103,20 +122,20 @@ Description: ``pkginfo`` README
0.6 (2010-06-01)
----------------
- - Replaced use of ``StringIO.StringIO`` with ``io.StringIO``, where available
+ - Replace use of ``StringIO.StringIO`` with ``io.StringIO``, where available
(Python >= 2.6).
- - Replaced use of ``rfc822`` stdlib module with ``email.parser``, when
+ - Replace use of ``rfc822`` stdlib module with ``email.parser``, when
available (Python >= 2.5). Ensured that distributions "unfold" wrapped
continuation lines, stripping any leading / trailing whitespace, no matter
which module was used for parsing.
- - Removed bogus testing dependency on ``zope.testing``.
+ - Remove bogus testing dependency on ``zope.testing``.
- - Added tests that the "environment markers" spelled out in the approved
+ - Add tests that the "environment markers" spelled out in the approved
PEP 345 are captured.
- - Added ``Project-URL`` for ``1.2`` PKG-INFO metdata (defined in the accepted
+ - Add ``Project-URL`` for ``1.2`` PKG-INFO metdata (defined in the accepted
version of PEP 345).
@@ -125,16 +144,16 @@ Description: ``pkginfo`` README
- Marked package as non-zip-safe.
- - Fixed Trove metadata misspelling.
+ - Fix Trove metadata misspelling.
- - Restored compatibility with Python 2.4.
+ - Restore compatibility with Python 2.4.
- - Noted that the introspection of installed packages / modules works only
+ - Note that the introspection of installed packages / modules works only
in Python 2.6 or later.
- - Added ``Index`` class as an abstraction over a collection of distributions.
+ - Add ``Index`` class as an abstraction over a collection of distributions.
- - Added ``download_url_prefix`` argument to ``pkginfo`` script. If passed,
+ - Add ``download_url_prefix`` argument to ``pkginfo`` script. If passed,
the script will use the prefix to synthesize a ``download_url`` for
distributions which do not supply that value directly.
@@ -142,18 +161,18 @@ Description: ``pkginfo`` README
0.4.1 (2009-05-07)
------------------
- - Fixed bugs in handling of installed packages which lack ``__file__``
+ - Fix bugs in handling of installed packages which lack ``__file__``
or ``PKG-INFO``.
0.4 (2009-05-07)
----------------
- - Extended the console script to allow output as CSV or INI. Also, added
+ - Extend the console script to allow output as CSV or INI. Also, added
arguments to specify the metadata version and other parsing / output
policies.
- - Added support for the different metadata versions specified in PEPs
+ - Add support for the different metadata versions specified in PEPs
241, 314, and 345. Distributions now parse and expose only the attributes
corresponding to their metadata version, which defaults to the version
parsed from the ``PKG-INFO`` file. The programmer can override that version
@@ -163,34 +182,34 @@ Description: ``pkginfo`` README
0.3 (2009-05-07)
----------------
- - Added support for introspection of "development eggs" (checkouts with
+ - Add support for introspection of "development eggs" (checkouts with
``PKG-INFO``, perhaps created via ``setup.py develop``).
- - Added a console script, ``pkginfo``, which takes one or more paths
+ - Add a console script, ``pkginfo``, which takes one or more paths
on the command line and writes out the associated information. Thanks
to ``runeh`` for the patch!
- - Added ``get_metadata`` helper function, which dispatches a given path or
+ - Add ``get_metadata`` helper function, which dispatches a given path or
module across the available distribution types, and returns a distribution
object. Thanks to ``runeh`` for the patch!
- - Made distribution objects support iteration over the metadata fields.
+ - Make distribution objects support iteration over the metadata fields.
Thanks to ``runeh`` for the patch!
- - Made Distribution and subclasses new-style classes. Thanks to ``runeh``
+ - Make ``Distribution`` and subclasses new-style classes. Thanks to ``runeh``
for the patch!
0.2 (2009-04-14)
----------------
- - Added support for introspection of ``bdist_egg`` binary distributions.
+ - Add support for introspection of ``bdist_egg`` binary distributions.
0.1.1 (2009-04-10)
------------------
- - Fixed packaging errors.
+ - Fix packaging errors.
0.1 (2009-04-10)
@@ -208,6 +227,7 @@ Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
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
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/docs/conf.py b/docs/conf.py
index 6daad66..1fa02f5 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -34,7 +34,7 @@ extensions = [
doctest_path = [os.path.abspath('..')]
# Add any paths that contain templates here, relative to this directory.
-templates_path = ['.templates']
+templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
@@ -54,9 +54,9 @@ copyright = u'2009-2013, Tres Seaver'
# built documents.
#
# The short X.Y version.
-version = '1.1'
+version = '1.2'
# The full version, including alpha/beta/rc tags.
-release = '1.1b1'
+release = '1.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -120,7 +120,7 @@ html_style = 'default.css'
# 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']
+html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
diff --git a/docs/distributions.rst b/docs/distributions.rst
index 1a06c9f..02cff5d 100644
--- a/docs/distributions.rst
+++ b/docs/distributions.rst
@@ -14,6 +14,8 @@ binary distributions, installed pakcages, and development checkouts.
>>> assert issubclass(UnpackedSDist, SDist)
>>> from pkginfo import BDist
>>> assert issubclass(BDist, Distribution)
+ >>> from pkginfo import Wheel
+ >>> assert issubclass(Wheel, Distribution)
>>> from pkginfo import Installed
>>> assert issubclass(Installed, Distribution)
>>> from pkginfo import Develop
@@ -112,6 +114,18 @@ generated via ``setup.py bdist_egg``.
After that, they have the same metadata as other ``Distribution`` objects,
+Introspecting Wheels
+--------------------
+
+``Wheel`` objects are created from the filename, which should have been
+generated via ``setup.py bdist_wheel``.
+
+.. doctest::
+
+ >>> mypackage = Wheel('docs/examples/mypackage-0.1-cp26-none-linux_x86_64.whl')
+
+After that, they have the same metadata as other ``Distribution`` objects,
+
Introspecting Installed Packages
--------------------------------
diff --git a/docs/examples/mypackage-0.1-cp26-none-linux_x86_64.whl b/docs/examples/mypackage-0.1-cp26-none-linux_x86_64.whl
new file mode 100644
index 0000000..271fca4
Binary files /dev/null and b/docs/examples/mypackage-0.1-cp26-none-linux_x86_64.whl differ
diff --git a/docs/examples/nodistinfo-0.1-any.whl b/docs/examples/nodistinfo-0.1-any.whl
new file mode 100644
index 0000000..2c503bd
Binary files /dev/null and b/docs/examples/nodistinfo-0.1-any.whl differ
diff --git a/docs/index.rst b/docs/index.rst
index d07d09d..d32523d 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -3,10 +3,10 @@
This package provides an API for querying the distutils metadata written in
the ``PKG-INFO`` file inside a source distriubtion (an ``sdist``) or a
-binary distribution (e.g., created by running ``bdist_egg``). It can
-also query the ``EGG-INFO`` directory of an installed distribution, and
-the ``*.egg-info`` stored in a "development checkout"
-(e.g, created by running ``setup.py develop``).
+binary distribution (e.g., created by running ``bdist_egg`` or
+``bdist_wheel``). It can also query the ``EGG-INFO`` directory of an
+installed distribution, and the ``*.egg-info`` stored in a "development
+checkout" (e.g, created by running ``setup.py develop``).
Contents:
diff --git a/pkginfo.egg-info/PKG-INFO b/pkginfo.egg-info/PKG-INFO
index 81901b5..92eab81 100644
--- a/pkginfo.egg-info/PKG-INFO
+++ b/pkginfo.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: pkginfo
-Version: 1.1
+Version: 1.2.1
Summary: Query metadatdata from sdists / bdists / installed packages.
Home-page: http://pypi.python.org/pypi/pkginfo/
Author: Tres Seaver, Agendaless Consulting
@@ -24,6 +24,25 @@ Description: ``pkginfo`` README
``pkginfo`` Changelog
=====================
+ 1.2.1 (2014-01-02)
+ ------------------
+
+ - Add overlooked Trove classifier for Python 3.4.
+
+ 1.2 (2014-01-02)
+ ----------------
+
+ - Add support for Python 3.4, PyPy3.
+
+ - Add 100% coverage for ``pkginfo.commandline`` module.
+
+ 1.2b1 (2013-12-05)
+ ------------------
+
+ - Add support for the "wheel" distribution format, along with minimal
+ metadata 2.0 support (not including new PEP 426 JSON properties).
+ Code (re-)borrowed from Donald Stuft's ``twine`` package.
+
1.1 (2013-10-09)
----------------
@@ -87,7 +106,7 @@ Description: ``pkginfo`` README
- Work around Python 2.7's breakage of StringIO. Fixes
https://bugs.launchpad.net/pkginfo/+bug/733827
- - Fixed bug in introspection of installed packages missing the
+ - Fix bug in introspection of installed packages missing the
``__package__`` attribute.
@@ -103,20 +122,20 @@ Description: ``pkginfo`` README
0.6 (2010-06-01)
----------------
- - Replaced use of ``StringIO.StringIO`` with ``io.StringIO``, where available
+ - Replace use of ``StringIO.StringIO`` with ``io.StringIO``, where available
(Python >= 2.6).
- - Replaced use of ``rfc822`` stdlib module with ``email.parser``, when
+ - Replace use of ``rfc822`` stdlib module with ``email.parser``, when
available (Python >= 2.5). Ensured that distributions "unfold" wrapped
continuation lines, stripping any leading / trailing whitespace, no matter
which module was used for parsing.
- - Removed bogus testing dependency on ``zope.testing``.
+ - Remove bogus testing dependency on ``zope.testing``.
- - Added tests that the "environment markers" spelled out in the approved
+ - Add tests that the "environment markers" spelled out in the approved
PEP 345 are captured.
- - Added ``Project-URL`` for ``1.2`` PKG-INFO metdata (defined in the accepted
+ - Add ``Project-URL`` for ``1.2`` PKG-INFO metdata (defined in the accepted
version of PEP 345).
@@ -125,16 +144,16 @@ Description: ``pkginfo`` README
- Marked package as non-zip-safe.
- - Fixed Trove metadata misspelling.
+ - Fix Trove metadata misspelling.
- - Restored compatibility with Python 2.4.
+ - Restore compatibility with Python 2.4.
- - Noted that the introspection of installed packages / modules works only
+ - Note that the introspection of installed packages / modules works only
in Python 2.6 or later.
- - Added ``Index`` class as an abstraction over a collection of distributions.
+ - Add ``Index`` class as an abstraction over a collection of distributions.
- - Added ``download_url_prefix`` argument to ``pkginfo`` script. If passed,
+ - Add ``download_url_prefix`` argument to ``pkginfo`` script. If passed,
the script will use the prefix to synthesize a ``download_url`` for
distributions which do not supply that value directly.
@@ -142,18 +161,18 @@ Description: ``pkginfo`` README
0.4.1 (2009-05-07)
------------------
- - Fixed bugs in handling of installed packages which lack ``__file__``
+ - Fix bugs in handling of installed packages which lack ``__file__``
or ``PKG-INFO``.
0.4 (2009-05-07)
----------------
- - Extended the console script to allow output as CSV or INI. Also, added
+ - Extend the console script to allow output as CSV or INI. Also, added
arguments to specify the metadata version and other parsing / output
policies.
- - Added support for the different metadata versions specified in PEPs
+ - Add support for the different metadata versions specified in PEPs
241, 314, and 345. Distributions now parse and expose only the attributes
corresponding to their metadata version, which defaults to the version
parsed from the ``PKG-INFO`` file. The programmer can override that version
@@ -163,34 +182,34 @@ Description: ``pkginfo`` README
0.3 (2009-05-07)
----------------
- - Added support for introspection of "development eggs" (checkouts with
+ - Add support for introspection of "development eggs" (checkouts with
``PKG-INFO``, perhaps created via ``setup.py develop``).
- - Added a console script, ``pkginfo``, which takes one or more paths
+ - Add a console script, ``pkginfo``, which takes one or more paths
on the command line and writes out the associated information. Thanks
to ``runeh`` for the patch!
- - Added ``get_metadata`` helper function, which dispatches a given path or
+ - Add ``get_metadata`` helper function, which dispatches a given path or
module across the available distribution types, and returns a distribution
object. Thanks to ``runeh`` for the patch!
- - Made distribution objects support iteration over the metadata fields.
+ - Make distribution objects support iteration over the metadata fields.
Thanks to ``runeh`` for the patch!
- - Made Distribution and subclasses new-style classes. Thanks to ``runeh``
+ - Make ``Distribution`` and subclasses new-style classes. Thanks to ``runeh``
for the patch!
0.2 (2009-04-14)
----------------
- - Added support for introspection of ``bdist_egg`` binary distributions.
+ - Add support for introspection of ``bdist_egg`` binary distributions.
0.1.1 (2009-04-10)
------------------
- - Fixed packaging errors.
+ - Fix packaging errors.
0.1 (2009-04-10)
@@ -208,6 +227,7 @@ Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
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
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/pkginfo.egg-info/SOURCES.txt b/pkginfo.egg-info/SOURCES.txt
index 93429d7..61cd431 100644
--- a/pkginfo.egg-info/SOURCES.txt
+++ b/pkginfo.egg-info/SOURCES.txt
@@ -11,10 +11,12 @@ docs/distributions.rst
docs/index.rst
docs/indexes.rst
docs/metadata.rst
+docs/examples/mypackage-0.1-cp26-none-linux_x86_64.whl
docs/examples/mypackage-0.1-py2.6.egg
docs/examples/mypackage-0.1.tar.bz2
docs/examples/mypackage-0.1.tar.gz
docs/examples/mypackage-0.1.zip
+docs/examples/nodistinfo-0.1-any.whl
docs/examples/nopkginfo-0.1.egg
docs/examples/nopkginfo-0.1.zip
docs/examples/mypackage-0.1/PKG-INFO
@@ -31,6 +33,7 @@ pkginfo/index.py
pkginfo/installed.py
pkginfo/sdist.py
pkginfo/utils.py
+pkginfo/wheel.py
pkginfo.egg-info/PKG-INFO
pkginfo.egg-info/SOURCES.txt
pkginfo.egg-info/dependency_links.txt
@@ -40,12 +43,14 @@ pkginfo.egg-info/requires.txt
pkginfo.egg-info/top_level.txt
pkginfo/tests/__init__.py
pkginfo/tests/test_bdist.py
+pkginfo/tests/test_commandline.py
pkginfo/tests/test_develop.py
pkginfo/tests/test_distribution.py
pkginfo/tests/test_index.py
pkginfo/tests/test_installed.py
pkginfo/tests/test_sdist.py
pkginfo/tests/test_utils.py
+pkginfo/tests/test_wheel.py
pkginfo/tests/funny/__init__.py
pkginfo/tests/funny/funny.egg-info
pkginfo/tests/manky/NOT-A-PACKAGE.txt
diff --git a/pkginfo.egg-info/requires.txt b/pkginfo.egg-info/requires.txt
index 4e2bd82..45b4506 100644
--- a/pkginfo.egg-info/requires.txt
+++ b/pkginfo.egg-info/requires.txt
@@ -1,5 +1,4 @@
-
[testing]
nose
-coverage
\ No newline at end of file
+coverage
diff --git a/pkginfo/__init__.py b/pkginfo/__init__.py
index 39e9684..0b3ba0a 100644
--- a/pkginfo/__init__.py
+++ b/pkginfo/__init__.py
@@ -6,3 +6,4 @@ from pkginfo.installed import Installed
from pkginfo.sdist import SDist
from pkginfo.sdist import UnpackedSDist
from pkginfo.utils import get_metadata
+from pkginfo.wheel import Wheel
diff --git a/pkginfo/commandline.py b/pkginfo/commandline.py
index 26191fe..ecadddb 100644
--- a/pkginfo/commandline.py
+++ b/pkginfo/commandline.py
@@ -16,7 +16,10 @@ o a "develop" checkout: in ths case, 'path' should point to a directory
o an installed package: in this case, 'path' should be the importable name
of the package.
"""
-from ConfigParser import ConfigParser
+try:
+ from configparser import ConfigParser
+except ImportError: # pragma: NO COVER
+ from ConfigParser import ConfigParser
from csv import writer
import optparse
import os
@@ -25,7 +28,7 @@ import sys
from pkginfo import get_metadata
-def _parse_options():
+def _parse_options(args=None):
parser = optparse.OptionParser(usage=__doc__)
parser.add_option("-m", "--metadata-version", default=None,
@@ -79,7 +82,7 @@ def _parse_options():
help="Output as INI",
)
- options, args = parser.parse_args()
+ options, args = parser.parse_args(args)
if len(args)==0:
parser.error("Pass one or more files or directories as arguments.")
@@ -92,7 +95,7 @@ class Base(object):
if options.fields:
self._fields = options.fields
- def finish(self):
+ def finish(self): # pragma: NO COVER
pass
class Simple(Base):
@@ -127,19 +130,18 @@ class SingleLine(Base):
print(self._item_delim.join(values))
class CSV(Base):
- _wrote_headers = False
+ _writer = None
def __init__(self, options):
super(CSV, self).__init__(options)
- self._writer = writer(sys.stdout)
self._sequence_delim = options.sequence_delim
def __call__(self, meta):
if self._fields is None:
self._fields = list(meta) # first dist wins
fields = self._fields
- if not self._wrote_headers: # latch
+ if self._writer is None:
+ self._writer = writer(sys.stdout)
self._writer.writerow(fields)
- self._wrote_headers = True
values = []
for field in fields:
value = getattr(meta, field)
@@ -170,7 +172,7 @@ class INI(Base):
self._parser.set(section, field, value)
def finish(self):
- self._parser.write(sys.stdout)
+ self._parser.write(sys.stdout) # pragma: NO COVER
_FORMATTERS = {
'simple': Simple,
@@ -179,10 +181,10 @@ _FORMATTERS = {
'ini': INI,
}
-def main():
+def main(args=None):
"""Entry point for pkginfo tool
"""
- options, paths = _parse_options()
+ options, paths = _parse_options(args)
format = getattr(options, 'output', 'simple')
formatter = _FORMATTERS[format](options)
diff --git a/pkginfo/distribution.py b/pkginfo/distribution.py
index 7408318..eb23c39 100644
--- a/pkginfo/distribution.py
+++ b/pkginfo/distribution.py
@@ -56,10 +56,13 @@ HEADER_ATTRS_1_2 = HEADER_ATTRS_1_1 + ( # PEP 345
('Project-URL', 'project_urls', True),
)
+HEADER_ATTRS_2_0 = HEADER_ATTRS_1_2 #XXX PEP 426?
+
HEADER_ATTRS = {
'1.0': HEADER_ATTRS_1_0,
'1.1': HEADER_ATTRS_1_1,
'1.2': HEADER_ATTRS_1_2,
+ '2.0': HEADER_ATTRS_2_0,
}
class Distribution(object):
diff --git a/pkginfo/tests/test_commandline.py b/pkginfo/tests/test_commandline.py
new file mode 100644
index 0000000..1848356
--- /dev/null
+++ b/pkginfo/tests/test_commandline.py
@@ -0,0 +1,294 @@
+import unittest
+
+class Test__parse_options(unittest.TestCase):
+
+ def _callFUT(self, args):
+ from pkginfo.commandline import _parse_options
+ return _parse_options(args)
+
+ def test_empty(self):
+ import io
+ import sys
+ from pkginfo.commandline import __doc__ as usage
+ firstline = usage.splitlines()[0]
+
+ # parse_args emits "native" error output.
+ if sys.version_info[0] < 3:
+ buf = io.BytesIO()
+ else:
+ buf = io.StringIO()
+
+ with _Monkey(sys, stderr=buf):
+ self.assertRaises(SystemExit, self._callFUT, [])
+ self.assertTrue(firstline in buf.getvalue())
+
+ def test_nonempty(self):
+ options, args = self._callFUT(['foo'])
+ self.assertEqual(args, ['foo'])
+
+class BaseTests(unittest.TestCase):
+
+ def _getTargetClass(self):
+ from pkginfo.commandline import Base
+ return Base
+
+ def _makeOne(self, options):
+ return self._getTargetClass()(options)
+
+ def test___init___defaults(self):
+ base = self._makeOne(_Options(fields=()))
+ self.assertTrue(base._fields is None)
+
+ def test___init___w_fields(self):
+ fields = object()
+ base = self._makeOne(_Options(fields=fields))
+ self.assertTrue(base._fields is fields)
+
+class _FormatterBase(object):
+
+ def _capture_output(self, func, *args, **kw):
+ import io
+ import sys
+ # Emulate stdout as wanting "native" strings
+ if sys.version_info[0] < 3:
+ buf = io.BytesIO()
+ else:
+ buf = io.StringIO()
+ with _Monkey(sys, stdout=buf):
+ func(*args, **kw)
+ return buf.getvalue()
+
+ def _no_output(self, simple, meta):
+ import sys
+ with _Monkey(sys, stdout=object()): # raise if write
+ simple(meta)
+
+class SimpleTests(unittest.TestCase, _FormatterBase):
+
+ def _getTargetClass(self):
+ from pkginfo.commandline import Simple
+ return Simple
+
+ def _makeOne(self, options):
+ return self._getTargetClass()(options)
+
+ def test___init___(self):
+ simple = self._makeOne(_Options(fields=None, skip=True))
+ self.assertTrue(simple._skip)
+
+ def test___call___w_empty_fields(self):
+ simple = self._makeOne(_Options(fields=(), skip=False))
+ meta = _Meta()
+ self._no_output(simple, meta)
+
+ def test___call___w_skip_and_value_None_no_fields(self):
+ simple = self._makeOne(_Options(fields=(), skip=True))
+ meta = _Meta(foo=None)
+ self._no_output(simple, meta)
+
+ def test___call___w_skip_and_value_empty_tuple_explicit_fields(self):
+ simple = self._makeOne(_Options(fields=('foo',), skip=True))
+ meta = _Meta(foo=(), bar='Bar')
+ self._no_output(simple, meta)
+
+ def test___call___w_skip_but_values_explicit_fields(self):
+ simple = self._makeOne(_Options(fields=('foo',), skip=True))
+ meta = _Meta(foo='Foo')
+ output = self._capture_output(simple, meta)
+ self.assertEqual(output, 'foo: Foo\n')
+
+class SingleLineTests(unittest.TestCase, _FormatterBase):
+
+ def _getTargetClass(self):
+ from pkginfo.commandline import SingleLine
+ return SingleLine
+
+ def _makeOne(self, options):
+ return self._getTargetClass()(options)
+
+ def test___init___(self):
+ single = self._makeOne(
+ _Options(fields=None, item_delim='I', sequence_delim='S'))
+ self.assertEqual(single._item_delim, 'I')
+ self.assertEqual(single._sequence_delim, 'S')
+
+ def test___call__wo_fields_wo_list(self):
+ single = self._makeOne(
+ _Options(fields=(), item_delim='|',
+ sequence_delim=object())) # raise if used
+ meta = _Meta(foo='Foo', bar='Bar')
+ output = self._capture_output(single, meta)
+ self.assertEqual(output, 'Bar|Foo\n')
+
+ def test___call__w_fields_w_list(self):
+ single = self._makeOne(
+ _Options(fields=('foo', 'bar'), item_delim='|',
+ sequence_delim='*'))
+ meta = _Meta(foo='Foo', bar=['Bar1', 'Bar2'], baz='Baz')
+ output = self._capture_output(single, meta)
+ self.assertEqual(output, 'Foo|Bar1*Bar2\n')
+
+class CSVTests(unittest.TestCase, _FormatterBase):
+
+ def _getTargetClass(self):
+ from pkginfo.commandline import CSV
+ return CSV
+
+ def _makeOne(self, options):
+ return self._getTargetClass()(options)
+
+ def test___init___(self):
+ csv = self._makeOne(
+ _Options(fields=None, sequence_delim='S'))
+ self.assertEqual(csv._sequence_delim, 'S')
+
+ def test___call__wo_fields_wo_list(self):
+ meta = _Meta(foo='Foo', bar='Bar')
+ csv = self._makeOne(
+ _Options(fields=None,
+ sequence_delim=object())) # raise if used
+ output = self._capture_output(csv, meta)
+ self.assertEqual(output, 'bar,foo\r\nBar,Foo\r\n')
+
+ def test___call__w_fields_w_list(self):
+ meta = _Meta(foo='Foo', bar=['Bar1', 'Bar2'], baz='Baz')
+ csv = self._makeOne(
+ _Options(fields=('foo', 'bar'), item_delim='|',
+ sequence_delim='*'))
+ output = self._capture_output(csv, meta)
+ self.assertEqual(output, 'foo,bar\r\nFoo,Bar1*Bar2\r\n')
+
+class INITests(unittest.TestCase, _FormatterBase):
+
+ def _getTargetClass(self):
+ from pkginfo.commandline import INI
+ return INI
+
+ def _makeOne(self, options):
+ return self._getTargetClass()(options)
+
+ def test___call___duplicate(self):
+ ini = self._makeOne(_Options(fields=('foo',)))
+ meta = _Meta(name='foo', version='0.1', foo='Foo')
+ ini._parser.add_section('foo-0.1')
+ self.assertRaises(ValueError, ini, meta)
+
+ def test___call___wo_fields_wo_list(self):
+ ini = self._makeOne(_Options(fields=None))
+ meta = _Meta(name='foo', version='0.1', foo='Foo')
+ ini(meta)
+ cp = ini._parser
+ self.assertEqual(cp.sections(), ['foo-0.1'])
+ self.assertEqual(sorted(cp.options('foo-0.1')),
+ ['foo', 'name', 'version'])
+ self.assertEqual(cp.get('foo-0.1', 'name'), 'foo')
+ self.assertEqual(cp.get('foo-0.1', 'version'), '0.1')
+ self.assertEqual(cp.get('foo-0.1', 'foo'), 'Foo')
+
+ def test___call___w_fields_w_list(self):
+ ini = self._makeOne(_Options(fields=('foo', 'bar')))
+ meta = _Meta(name='foo', version='0.1',
+ foo='Foo', bar=['Bar1', 'Bar2'], baz='Baz')
+ ini(meta)
+ cp = ini._parser
+ self.assertEqual(cp.sections(), ['foo-0.1'])
+ self.assertEqual(sorted(cp.options('foo-0.1')), ['bar', 'foo'])
+ self.assertEqual(cp.get('foo-0.1', 'foo'), 'Foo')
+ self.assertEqual(cp.get('foo-0.1', 'bar'), 'Bar1\n\tBar2')
+
+class Test_main(unittest.TestCase):
+
+ def _callFUT(self, args, monkey='simple'):
+ from pkginfo.commandline import main
+ from pkginfo.commandline import _FORMATTERS
+ before = _FORMATTERS[monkey]
... 434 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pkginfo.git
More information about the Python-modules-commits
mailing list