Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
acd94990
Commit
acd94990
authored
Dec 11, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into issue250-module_from_spec
parents
27b7d4e4
5c940698
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1349 additions
and
29 deletions
+1349
-29
CHANGES.rst
CHANGES.rst
+22
-0
README.rst
README.rst
+2
-2
conftest.py
conftest.py
+0
-17
docs/_templates/indexsidebar.html
docs/_templates/indexsidebar.html
+1
-1
docs/index.txt
docs/index.txt
+3
-3
docs/setuptools.txt
docs/setuptools.txt
+205
-0
setup.cfg
setup.cfg
+1
-1
setup.py
setup.py
+1
-1
setuptools/command/build_py.py
setuptools/command/build_py.py
+1
-1
setuptools/command/test.py
setuptools/command/test.py
+2
-0
setuptools/config.py
setuptools/config.py
+558
-0
setuptools/dist.py
setuptools/dist.py
+10
-0
setuptools/tests/environment.py
setuptools/tests/environment.py
+1
-1
setuptools/tests/test_config.py
setuptools/tests/test_config.py
+539
-0
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+1
-1
tox.ini
tox.ini
+2
-1
No files found.
CHANGES.rst
View file @
acd94990
v30
.4.0
-------
*
#
879
:
For
declarative
config
:
-
read_configuration
()
now
accepts
ignore_option_errors
argument
.
This
allows
scraping
tools
to
read
metadata
without
a
need
to
download
entire
packages
.
E
.
g
.
we
can
gather
some
stats
right
from
GitHub
repos
just
by
downloading
setup
.
cfg
.
-
packages
find
:
directive
now
supports
fine
tuning
from
a
subsection
.
The
same
arguments
as
for
find
()
are
accepted
.
v30
.3.0
-------
*
#
394
via
#
862
:
Added
support
for
`
declarative
package
config
in
a
setup
.
cfg
file
<
http
://
setuptools
.
readthedocs
.
io
/
en
/
latest
/
setuptools
.
html
#
configuring
-
setup
-
using
-
setup
-
cfg
-
files
>`
_
.
v30
.2.1
-------
*
#
850
:
In
test
command
,
invoke
unittest
.
main
with
indication
not
to
exit
the
process
.
v30
.2.0
v30
.2.0
-------
-------
...
...
README.rst
View file @
acd94990
...
@@ -139,10 +139,10 @@ Package Index`_. Scroll to the very bottom of the page to find the links.
...
@@ -139,10 +139,10 @@ Package Index`_. Scroll to the very bottom of the page to find the links.
.. _the project's home page in the Python Package Index: https://pypi.python.org/pypi/setuptools
.. _the project's home page in the Python Package Index: https://pypi.python.org/pypi/setuptools
In addition to the PyPI downloads, the development version of ``setuptools``
In addition to the PyPI downloads, the development version of ``setuptools``
is available from the `
Bitbucket
repo`_, and in-development versions of the
is available from the `
GitHub
repo`_, and in-development versions of the
`0.6 branch`_ are available as well.
`0.6 branch`_ are available as well.
.. _
Bitbucket repo: https://bitbucket.org/pypa/setuptools/get/default
.tar.gz#egg=setuptools-dev
.. _
GitHub repo: https://github.com/pypa/setuptools/archive/master
.tar.gz#egg=setuptools-dev
.. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06
.. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06
Uninstalling
Uninstalling
...
...
conftest.py
View file @
acd94990
import
os
pytest_plugins
=
'setuptools.tests.fixtures'
pytest_plugins
=
'setuptools.tests.fixtures'
...
@@ -9,17 +6,3 @@ def pytest_addoption(parser):
...
@@ -9,17 +6,3 @@ def pytest_addoption(parser):
"--package_name"
,
action
=
"append"
,
default
=
[],
"--package_name"
,
action
=
"append"
,
default
=
[],
help
=
"list of package_name to pass to test functions"
,
help
=
"list of package_name to pass to test functions"
,
)
)
def
pytest_configure
():
_issue_852_workaround
()
def
_issue_852_workaround
():
"""
Patch 'setuptools.__file__' with an absolute path
for forward compatibility with Python 3.
Workaround for https://github.com/pypa/setuptools/issues/852
"""
setuptools
=
__import__
(
'setuptools'
)
setuptools
.
__file__
=
os
.
path
.
abspath
(
setuptools
.
__file__
)
docs/_templates/indexsidebar.html
View file @
acd94990
...
@@ -5,4 +5,4 @@
...
@@ -5,4 +5,4 @@
<h3>
Questions? Suggestions? Contributions?
</h3>
<h3>
Questions? Suggestions? Contributions?
</h3>
<p>
Visit the
<a
href=
"https://
bitbucket.org
/pypa/setuptools"
>
Setuptools project page
</a>
</p>
<p>
Visit the
<a
href=
"https://
github.com
/pypa/setuptools"
>
Setuptools project page
</a>
</p>
docs/index.txt
View file @
acd94990
...
@@ -16,10 +16,10 @@ Documentation content:
...
@@ -16,10 +16,10 @@ Documentation content:
.. toctree::
.. toctree::
:maxdepth: 2
:maxdepth: 2
history
roadmap
python3
setuptools
setuptools
easy_install
easy_install
pkg_resources
pkg_resources
python3
development
development
roadmap
history
docs/setuptools.txt
View file @
acd94990
...
@@ -2398,6 +2398,211 @@ The ``upload_docs`` command has the following options:
...
@@ -2398,6 +2398,211 @@ The ``upload_docs`` command has the following options:
https://pypi.python.org/pypi (i.e., the main PyPI installation).
https://pypi.python.org/pypi (i.e., the main PyPI installation).
-----------------------------------------
Configuring setup() using setup.cfg files
-----------------------------------------
``Setuptools`` allows using configuration files (usually `setup.cfg`)
to define package’s metadata and other options which are normally supplied
to ``setup()`` function.
This approach not only allows automation scenarios, but also reduces
boilerplate code in some cases.
.. note::
Implementation presents limited compatibility with distutils2-like
``setup.cfg`` sections (used by ``pbr`` and ``d2to1`` packages).
Namely: only metadata related keys from ``metadata`` section are supported
(except for ``description-file``); keys from ``files``, ``entry_points``
and ``backwards_compat`` are not supported.
.. code-block:: ini
[metadata]
name = my_package
version = attr: src.VERSION
description = My package description
long_description = file: README.rst
keywords = one, two
license = BSD 3-Clause License
[metadata.classifiers]
Framework :: Django
Programming Language :: Python :: 3.5
[options]
zip_safe = False
include_package_data = True
packages = find:
scripts =
bin/first.py
bin/second.py
[options.package_data]
* = *.txt, *.rst
hello = *.msg
[options.extras_require]
pdf = ReportLab>=1.2; RXP
rest = docutils>=0.3; pack ==1.1, ==1.3
[options.packages.find]
exclude =
src.subpackage1
src.subpackage2
Metadata and options could be set in sections with the same names.
* Keys are the same as keyword arguments one provides to ``setup()`` function.
* Complex values could be placed comma-separated or one per line
in *dangling* sections. The following are the same:
.. code-block:: ini
[metadata]
keywords = one, two
[metadata]
keywords =
one
two
* In some cases complex values could be provided in subsections for clarity.
* Some keys allow ``file:``, ``attr:`` and ``find:`` directives to cover
common usecases.
* Unknown keys are ignored.
Specifying values
=================
Some values are treated as simple strings, some allow more logic.
Type names used below:
* ``str`` - simple string
* ``list-comma`` - dangling list or comma-separated values string
* ``list-semi`` - dangling list or semicolon-separated values string
* ``bool`` - ``True`` is 1, yes, true
* ``dict`` - list-comma where keys from values are separated by =
* ``section`` - values could be read from a dedicated (sub)section
Special directives:
* ``attr:`` - value could be read from module attribute
* ``file:`` - value could be read from a file
.. note::
``file:`` directive is sandboxed and won't reach anything outside
directory with ``setup.py``.
Metadata
--------
.. note::
Aliases given below are supported for compatibility reasons,
but not advised.
================= ================= =====
Key Aliases Accepted value type
================= ================= =====
name str
version attr:, str
url home-page str
download_url download-url str
author str
author_email author-email str
maintainer str
maintainer_email maintainer-email str
classifiers classifier file:, section, list-comma
license file:, str
description summary file:, str
long_description long-description file:, str
keywords list-comma
platforms platform list-comma
provides list-comma
requires list-comma
obsoletes list-comma
================= ================= =====
.. note::
**version** - ``attr:`` supports callables; supports iterables;
unsupported types are casted using ``str()``.
Options
-------
======================= =====
Key Accepted value type
======================= =====
zip_safe bool
setup_requires list-semi
install_requires list-semi
extras_require section
entry_points file:, section
use_2to3 bool
use_2to3_fixers list-comma
use_2to3_exclude_fixers list-comma
convert_2to3_doctests list-comma
scripts list-comma
eager_resources list-comma
dependency_links list-comma
tests_require list-semi
include_package_data bool
packages find:, list-comma
package_dir dict
package_data section
exclude_package_data section
namespace_packages list-comma
======================= =====
.. note::
**packages** - ``find:`` directive can be further configured
in a dedicated subsection `options.packages.find`. This subsection
accepts the same keys as `setuptools.find` function:
`where`, `include`, `exclude`.
Configuration API
=================
Some automation tools may wish to access data from a configuration file.
``Setuptools`` exposes ``read_configuration()`` function allowing
parsing ``metadata`` and ``options`` sections into a dictionary.
.. code-block:: python
from setuptools.config import read_configuration
conf_dict = read_configuration('/home/user/dev/package/setup.cfg')
By default ``read_configuration()`` will read only file provided
in the first argument. To include values from other configuration files
which could be in various places set `find_others` function argument
to ``True``.
If you have only a configuration file but not the whole package you can still
try to get data out of it with the help of `ignore_option_errors` function
argument. When it is set to ``True`` all options with errors possibly produced
by directives, such as ``attr:`` and others will be silently ignored.
As a consequence the resulting dictionary will include no such options.
--------------------------------
--------------------------------
Extending and Reusing Setuptools
Extending and Reusing Setuptools
--------------------------------
--------------------------------
...
...
setup.cfg
View file @
acd94990
[bumpversion]
[bumpversion]
current_version = 30.
2
.0
current_version = 30.
4
.0
commit = True
commit = True
tag = True
tag = True
...
...
setup.py
View file @
acd94990
...
@@ -85,7 +85,7 @@ def pypi_link(pkg_filename):
...
@@ -85,7 +85,7 @@ def pypi_link(pkg_filename):
setup_params
=
dict
(
setup_params
=
dict
(
name
=
"setuptools"
,
name
=
"setuptools"
,
version
=
"30.
2
.0"
,
version
=
"30.
4
.0"
,
description
=
"Easily download, build, install, upgrade, and uninstall "
description
=
"Easily download, build, install, upgrade, and uninstall "
"Python packages"
,
"Python packages"
,
author
=
"Python Packaging Authority"
,
author
=
"Python Packaging Authority"
,
...
...
setuptools/command/build_py.py
View file @
acd94990
...
@@ -219,7 +219,7 @@ class build_py(orig.build_py, Mixin2to3):
...
@@ -219,7 +219,7 @@ class build_py(orig.build_py, Mixin2to3):
@
staticmethod
@
staticmethod
def
_get_platform_patterns
(
spec
,
package
,
src_dir
):
def
_get_platform_patterns
(
spec
,
package
,
src_dir
):
"""
"""
yield platf
ro
m-specific path patterns (suitable for glob
yield platf
or
m-specific path patterns (suitable for glob
or fn_match) from a glob-based spec (such as
or fn_match) from a glob-based spec (such as
self.package_data or self.exclude_package_data)
self.package_data or self.exclude_package_data)
matching package in src_dir.
matching package in src_dir.
...
...
setuptools/command/test.py
View file @
acd94990
...
@@ -225,10 +225,12 @@ class test(Command):
...
@@ -225,10 +225,12 @@ class test(Command):
del_modules
.
append
(
name
)
del_modules
.
append
(
name
)
list
(
map
(
sys
.
modules
.
__delitem__
,
del_modules
))
list
(
map
(
sys
.
modules
.
__delitem__
,
del_modules
))
exit_kwarg
=
{}
if
sys
.
version_info
<
(
2
,
7
)
else
{
"exit"
:
False
}
unittest_main
(
unittest_main
(
None
,
None
,
self
.
_argv
,
None
,
None
,
self
.
_argv
,
testLoader
=
self
.
_resolve_as_ep
(
self
.
test_loader
),
testLoader
=
self
.
_resolve_as_ep
(
self
.
test_loader
),
testRunner
=
self
.
_resolve_as_ep
(
self
.
test_runner
),
testRunner
=
self
.
_resolve_as_ep
(
self
.
test_runner
),
**
exit_kwarg
)
)
@
property
@
property
...
...
setuptools/config.py
0 → 100644
View file @
acd94990
This diff is collapsed.
Click to expand it.
setuptools/dist.py
View file @
acd94990
...
@@ -19,6 +19,7 @@ from pkg_resources.extern import packaging
...
@@ -19,6 +19,7 @@ from pkg_resources.extern import packaging
from
setuptools.depends
import
Require
from
setuptools.depends
import
Require
from
setuptools
import
windows_support
from
setuptools
import
windows_support
from
setuptools.monkey
import
get_unpatched
from
setuptools.monkey
import
get_unpatched
from
setuptools.config
import
parse_configuration
import
pkg_resources
import
pkg_resources
...
@@ -342,6 +343,15 @@ class Distribution(_Distribution):
...
@@ -342,6 +343,15 @@ class Distribution(_Distribution):
if getattr(self, '
python_requires
', None):
if getattr(self, '
python_requires
', None):
self.metadata.python_requires = self.python_requires
self.metadata.python_requires = self.python_requires
def parse_config_files(self, filenames=None):
"""Parses configuration files from various levels
and loads configuration.
"""
_Distribution.parse_config_files(self, filenames=filenames)
parse_configuration(self, self.command_options)
def parse_command_line(self):
def parse_command_line(self):
"""Process features after parsing command line options"""
"""Process features after parsing command line options"""
result = _Distribution.parse_command_line(self)
result = _Distribution.parse_command_line(self)
...
...
setuptools/tests/environment.py
View file @
acd94990
...
@@ -56,5 +56,5 @@ def run_setup_py(cmd, pypath=None, path=None,
...
@@ -56,5 +56,5 @@ def run_setup_py(cmd, pypath=None, path=None,
data
=
data
.
decode
()
data
=
data
.
decode
()
data
=
unicodedata
.
normalize
(
'NFC'
,
data
)
data
=
unicodedata
.
normalize
(
'NFC'
,
data
)
# commun
ci
ate calls wait()
# commun
ic
ate calls wait()
return
proc
.
returncode
,
data
return
proc
.
returncode
,
data
setuptools/tests/test_config.py
0 → 100644
View file @
acd94990
This diff is collapsed.
Click to expand it.
setuptools/tests/test_egg_info.py
View file @
acd94990
...
@@ -237,7 +237,7 @@ class TestEggInfo(object):
...
@@ -237,7 +237,7 @@ class TestEggInfo(object):
pkginfo
=
os
.
path
.
join
(
egg_info_dir
,
'PKG-INFO'
)
pkginfo
=
os
.
path
.
join
(
egg_info_dir
,
'PKG-INFO'
)
assert
'Requires-Python: >=1.2.3'
in
open
(
pkginfo
).
read
().
split
(
'
\
n
'
)
assert
'Requires-Python: >=1.2.3'
in
open
(
pkginfo
).
read
().
split
(
'
\
n
'
)
def
test_manifest_maker_warning_suppresion
(
self
):
def
test_manifest_maker_warning_suppres
s
ion
(
self
):
fixtures
=
[
fixtures
=
[
"standard file not found: should have one of foo.py, bar.py"
,
"standard file not found: should have one of foo.py, bar.py"
,
"standard file 'setup.py' not found"
"standard file 'setup.py' not found"
...
...
tox.ini
View file @
acd94990
[testenv]
[testenv]
deps
=
-rtests/requirements.txt
deps
=
-rtests/requirements.txt
passenv
=
APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir APPVEYOR
passenv
=
APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir APPVEYOR
commands
=
python -m pytest {posargs:-rsx}
commands
=
py.test {posargs:-rsx}
usedevelop
=
True
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