Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
51f2f16e
Commit
51f2f16e
authored
Apr 02, 2010
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed documentation on code that was reverted and pushed into distutils2
parent
e33fa887
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
110 deletions
+0
-110
Doc/distutils/apiref.rst
Doc/distutils/apiref.rst
+0
-13
Doc/distutils/examples.rst
Doc/distutils/examples.rst
+0
-97
No files found.
Doc/distutils/apiref.rst
View file @
51f2f16e
...
...
@@ -1926,19 +1926,6 @@ This is described in more detail in :pep:`301`.
.. % todo
:mod:`distutils.command.check` --- Check the meta-data of a package
===================================================================
.. module:: distutils.command.check
:synopsis: Check the metadata of a package
The ``check`` command performs some tests on the meta-data of a package.
For example, it verifies that all required meta-data are provided as
the arguments passed to the :func:`setup` function.
.. % todo
Creating a new Distutils command
================================
...
...
Doc/distutils/examples.rst
View file @
51f2f16e
...
...
@@ -233,103 +233,6 @@ With exactly the same source tree layout, this extension can be put in the
ext_modules
=[
Extension
(
'foopkg.foo'
,
[
'foo.c'
])],
)
Checking
a
package
==================
The
``
check
``
command
allows
you
to
verify
if
your
package
meta
-
data
meet
the
minimum
requirements
to
build
a
distribution
.
To
run
it
,
just
call
it
using
your
:
file
:`
setup
.
py
`
script
.
If
something
is
missing
,
``
check
``
will
display
a
warning
.
Let
's take an example with a simple script::
from distutils.core import setup
setup(name='
foobar
')
Running the ``check`` command will display some warnings::
$ python setup.py check
running check
warning: check: missing required meta-data: version, url
warning: check: missing meta-data: either (author and author_email) or
(maintainer and maintainer_email) must be supplied
If you use the reStructuredText syntax in the ``long_description`` field and
`docutils <http://docutils.sourceforge.net/>`_ is installed you can check if
the syntax is fine with the ``check`` command, using the ``restructuredtext``
option.
For example, if the :file:`setup.py` script is changed like this::
from distutils.core import setup
desc = """\
My description
=============
This is the description of the ``foobar`` package.
"""
setup(name='
foobar
', version='
1
', author='
tarek
',
author_email='
tarek
@
ziade
.
org
',
url='
http
://
example
.
com
', long_description=desc)
Where the long description is broken, ``check`` will be able to detect it
by using the :mod:`docutils` parser::
$ pythontrunk setup.py check --restructuredtext
running check
warning: check: Title underline too short. (line 2)
warning: check: Could not finish the parsing.
.. _reading-metadata:
Reading the metadata
====================
The :func:`distutils.core.setup` function provides a command-line interface
that allows you to query the metadata fields of a project through the
:file:`setup.py` script of a given project::
$ python setup.py --name
distribute
This call reads the ``name`` metadata by running the
:func:`distutils.core.setup` function. Although, when a source or binary
distribution is created with Distutils, the metadata fields are written
in a static file called :file:`PKG-INFO`. When a Distutils-based project is
installed in Python, the :file:`PKG-INFO` file is copied alongside the modules
and packages of the distribution under :file:`NAME-VERSION-pyX.X.egg-info`,
where ``NAME`` is the name of the project, ``VERSION`` its version as defined
in the Metadata, and ``pyX.X`` the major and minor version of Python like
``2.7`` or ``3.2``.
You can read back this static file, by using the
:class:`distutils.dist.DistributionMetadata` class and its
:func:`read_pkg_file` method::
>>> from distutils.dist import DistributionMetadata
>>> metadata = DistributionMetadata()
>>> metadata.read_pkg_file(open('
distribute
-
0.6.8
-
py2
.7
.
egg
-
info
'))
>>> metadata.name
'
distribute
'
>>> metadata.version
'
0.6.8
'
>>> metadata.description
'
Easily
download
,
build
,
install
,
upgrade
,
and
uninstall
Python
packages
'
Notice that the class can also be instanciated with a metadata file path to
loads its values::
>>> pkg_info_path = '
distribute
-
0.6.8
-
py2
.7
.
egg
-
info
'
>>> DistributionMetadata(pkg_info_path).name
'
distribute
'
..
%
\
section
{
Multiple
extension
modules
}
..
%
\
label
{
multiple
-
ext
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment