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
e00a6703
Commit
e00a6703
authored
Jun 09, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Plain Diff
Branch merge
parents
9a82eaad
e6792c1e
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
108 additions
and
83 deletions
+108
-83
Doc/library/packaging.compiler.rst
Doc/library/packaging.compiler.rst
+4
-2
Doc/packaging/setupcfg.rst
Doc/packaging/setupcfg.rst
+50
-18
Lib/packaging/create.py
Lib/packaging/create.py
+4
-4
Lib/packaging/database.py
Lib/packaging/database.py
+3
-3
Lib/packaging/depgraph.py
Lib/packaging/depgraph.py
+16
-13
Lib/packaging/dist.py
Lib/packaging/dist.py
+4
-4
Lib/packaging/pypi/dist.py
Lib/packaging/pypi/dist.py
+3
-3
Lib/packaging/pypi/simple.py
Lib/packaging/pypi/simple.py
+4
-3
Lib/packaging/run.py
Lib/packaging/run.py
+10
-11
Lib/packaging/tests/test_command_bdist_dumb.py
Lib/packaging/tests/test_command_bdist_dumb.py
+0
-1
Lib/packaging/tests/test_command_build_py.py
Lib/packaging/tests/test_command_build_py.py
+0
-4
Lib/packaging/tests/test_command_install_dist.py
Lib/packaging/tests/test_command_install_dist.py
+0
-2
Lib/packaging/tests/test_command_install_lib.py
Lib/packaging/tests/test_command_install_lib.py
+0
-2
Lib/packaging/tests/test_command_sdist.py
Lib/packaging/tests/test_command_sdist.py
+0
-10
Lib/packaging/tests/test_config.py
Lib/packaging/tests/test_config.py
+2
-2
Lib/packaging/util.py
Lib/packaging/util.py
+1
-1
setup.py
setup.py
+7
-0
No files found.
Doc/library/packaging.compiler.rst
View file @
e00a6703
...
@@ -569,10 +569,10 @@ extension modules.
...
@@ -569,10 +569,10 @@ extension modules.
.. class:: Extension
.. class:: Extension
The Extension class describes a single C or C++ extension module. It accepts
The Extension class describes a single C or C++ extension module. It accepts
the following keyword arguments in its constructor
the following keyword arguments in its constructor
:
+------------------------+--------------------------------+---------------------------+
+------------------------+--------------------------------+---------------------------+
| argument name | value | type
|
| argument name | value | type
[#]_
|
+========================+================================+===========================+
+========================+================================+===========================+
| *name* | the full name of the | string |
| *name* | the full name of the | string |
| | extension, including any | |
| | extension, including any | |
...
@@ -670,3 +670,5 @@ extension modules.
...
@@ -670,3 +670,5 @@ extension modules.
| | from the source extensions if | |
| | from the source extensions if | |
| | not provided. | |
| | not provided. | |
+------------------------+--------------------------------+---------------------------+
+------------------------+--------------------------------+---------------------------+
.. [#] For values documented as lists, the given type is the type of each element.
Doc/packaging/setupcfg.rst
View file @
e00a6703
...
@@ -141,13 +141,16 @@ files
...
@@ -141,13 +141,16 @@ files
Modules, scripts, data, documentation and other files to include in the
Modules, scripts, data, documentation and other files to include in the
distribution.
distribution.
extension sections
Options used to build extension modules.
command sections
command sections
Options given for specific commands, identical to those that can be given
Options given for specific commands, identical to those that can be given
on the command line.
on the command line.
Global options
Global options
==============
--------------
Contains global options for Packaging. This section is shared with Distutils.
Contains global options for Packaging. This section is shared with Distutils.
...
@@ -185,7 +188,7 @@ setup_hook
...
@@ -185,7 +188,7 @@ setup_hook
Metadata
Metadata
========
--------
The metadata section contains the metadata for the project as described in
The metadata section contains the metadata for the project as described in
:PEP:`345`. Field names are case-insensitive.
:PEP:`345`. Field names are case-insensitive.
...
@@ -308,7 +311,7 @@ from the fields present in the file.
...
@@ -308,7 +311,7 @@ from the fields present in the file.
Files
Files
=====
-----
This section describes the files included in the project.
This section describes the files included in the project.
...
@@ -352,7 +355,7 @@ Example::
...
@@ -352,7 +355,7 @@ Example::
Resources
Resources
---------
^^^^^^^^^
This section describes the files used by the project which must not be installed
This section describes the files used by the project which must not be installed
in the same place that python modules or libraries, they are called
in the same place that python modules or libraries, they are called
...
@@ -448,10 +451,10 @@ Where {datafir} category will be platform-dependent.
...
@@ -448,10 +451,10 @@ Where {datafir} category will be platform-dependent.
More control on source part
More control on source part
^^^^^^^^^^^^^^^^^^^^^^^^^^^
"""""""""""""""""""""""""""
Glob syntax
Glob syntax
"""""""""""
'''''''''''
When you declare source file, you can use a glob-like syntax to match multiples file, for example::
When you declare source file, you can use a glob-like syntax to match multiples file, for example::
...
@@ -469,7 +472,7 @@ Glob tokens are:
...
@@ -469,7 +472,7 @@ Glob tokens are:
.. TODO Add examples
.. TODO Add examples
Order of declaration
Order of declaration
""""""""""""""""""""
''''''''''''''''''''
The order of declaration is important if one file match multiple rules. The last
The order of declaration is important if one file match multiple rules. The last
rules matched by file is used, this is useful if you have this source tree::
rules matched by file is used, this is useful if you have this source tree::
...
@@ -492,7 +495,7 @@ one by one, you can declare them in this way::
...
@@ -492,7 +495,7 @@ one by one, you can declare them in this way::
doc/README = {help}
doc/README = {help}
Exclude
Exclude
"""""""
'''''''
You can exclude some files of resources declaration by giving no destination, it
You can exclude some files of resources declaration by giving no destination, it
can be useful if you have a non-resources file in the same directory of
can be useful if you have a non-resources file in the same directory of
...
@@ -513,12 +516,12 @@ Your **files** section will be::
...
@@ -513,12 +516,12 @@ Your **files** section will be::
doc/RELEASES =
doc/RELEASES =
More control on destination part
More control on destination part
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
""""""""""""""""""""""""""""""""
.. _setupcfg-resources-base-prefix:
.. _setupcfg-resources-base-prefix:
Defining a base prefix
Defining a base prefix
""""""""""""""""""""""
''''''''''''''''''''''
When you define your resources, you can have more control of how the final path
When you define your resources, you can have more control of how the final path
is computed.
is computed.
...
@@ -577,7 +580,7 @@ path will be::
...
@@ -577,7 +580,7 @@ path will be::
Overwriting paths for categories
Overwriting paths for categories
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
""""""""""""""""""""""""""""""""
This part is intended for system administrators or downstream OS packagers.
This part is intended for system administrators or downstream OS packagers.
...
@@ -614,18 +617,18 @@ The platform-dependent categories are:
...
@@ -614,18 +617,18 @@ The platform-dependent categories are:
Defining extra categories
Defining extra categories
^^^^^^^^^^^^^^^^^^^^^^^^^
"""""""""""""""""""""""""
.. TODO
.. TODO
Examples
Examples
^^^^^^^^
""""""""
These examples are incremental but work unitarily.
These examples are incremental but work unitarily.
Resources in root dir
Resources in root dir
"""""""""""""""""""""
'''''''''''''''''''''
Source tree::
Source tree::
...
@@ -647,7 +650,7 @@ So babar.sh and launch.sh will be placed in {scripts} directory.
...
@@ -647,7 +650,7 @@ So babar.sh and launch.sh will be placed in {scripts} directory.
Now let's move all the scripts into a scripts directory.
Now let's move all the scripts into a scripts directory.
Resources in sub-directory
Resources in sub-directory
""""""""""""""""""""""""""
''''''''''''''''''''''''''
Source tree::
Source tree::
...
@@ -673,7 +676,7 @@ scripts into {scripts} instead of {scripts}/scripts.
...
@@ -673,7 +676,7 @@ scripts into {scripts} instead of {scripts}/scripts.
Now let's add some docs.
Now let's add some docs.
Resources in multiple sub-directories
Resources in multiple sub-directories
"""""""""""""""""""""""""""""""""""""
'''''''''''''''''''''''''''''''''''''
Source tree::
Source tree::
...
@@ -706,7 +709,7 @@ file is used.
...
@@ -706,7 +709,7 @@ file is used.
Now let's add some scripts for windows users.
Now let's add some scripts for windows users.
Complete example
Complete example
""""""""""""""""
''''''''''''''''
Source tree::
Source tree::
...
@@ -736,8 +739,37 @@ We use brace expansion syntax to place all the shell and batch scripts into
...
@@ -736,8 +739,37 @@ We use brace expansion syntax to place all the shell and batch scripts into
{scripts} category.
{scripts} category.
Extension sections
------------------
If a project includes extension modules written in C or C++, each one of them
needs to have its options defined in a dedicated section. Here's an example::
[files]
packages = coconut
[extension=_fastcoconut]
name = coconut._fastcoconut
language = cxx
sources = cxx_src/cononut_utils.cxx
cxx_src/python_module.cxx
include_dirs = /usr/include/gecode
/usr/include/blitz
extra_compile_args =
-fPIC -O2
-DGECODE_VERSION=$(./gecode_version) -- sys.platform != 'win32'
/DGECODE_VERSION='win32' -- sys.platform == 'win32'
The section name must start with ``extension=``; the righ-hand part is currently
discarded. Valid fields and their values are listed in the documentation of the
:class:`packaging.compiler.extension.Extension` class; values documented as
Python lists translate to multi-line values in the configuration file. In
addition, multi-line values accept environment markers on each line, after a
``--``.
Command sections
Command sections
================
----------------
To pass options to commands without having to type them on the command line
To pass options to commands without having to type them on the command line
for each invocation, you can write them in the :file:`setup.cfg` file, in a
for each invocation, you can write them in the :file:`setup.cfg` file, in a
...
...
Lib/packaging/create.py
View file @
e00a6703
...
@@ -175,11 +175,11 @@ def convert_yn_to_bool(yn, yes=True, no=False):
...
@@ -175,11 +175,11 @@ def convert_yn_to_bool(yn, yes=True, no=False):
def
_build_classifiers_dict
(
classifiers
):
def
_build_classifiers_dict
(
classifiers
):
d
=
{}
d
=
{}
for
key
in
classifiers
:
for
key
in
classifiers
:
sub
D
ict
=
d
sub
d
ict
=
d
for
subkey
in
key
.
split
(
' :: '
):
for
subkey
in
key
.
split
(
' :: '
):
if
not
subkey
in
subD
ict
:
if
subkey
not
in
subd
ict
:
sub
D
ict
[
subkey
]
=
{}
sub
d
ict
[
subkey
]
=
{}
sub
Dict
=
subD
ict
[
subkey
]
sub
dict
=
subd
ict
[
subkey
]
return
d
return
d
CLASSIFIERS
=
_build_classifiers_dict
(
_CLASSIFIERS_LIST
)
CLASSIFIERS
=
_build_classifiers_dict
(
_CLASSIFIERS_LIST
)
...
...
Lib/packaging/database.py
View file @
e00a6703
...
@@ -104,12 +104,12 @@ def _generate_cache(use_egg_info=False, paths=sys.path):
...
@@ -104,12 +104,12 @@ def _generate_cache(use_egg_info=False, paths=sys.path):
for
dist
in
_yield_distributions
(
gen_dist
,
gen_egg
,
paths
):
for
dist
in
_yield_distributions
(
gen_dist
,
gen_egg
,
paths
):
if
isinstance
(
dist
,
Distribution
):
if
isinstance
(
dist
,
Distribution
):
_cache_path
[
dist
.
path
]
=
dist
_cache_path
[
dist
.
path
]
=
dist
if
not
dist
.
name
in
_cache_name
:
if
dist
.
name
not
in
_cache_name
:
_cache_name
[
dist
.
name
]
=
[]
_cache_name
[
dist
.
name
]
=
[]
_cache_name
[
dist
.
name
].
append
(
dist
)
_cache_name
[
dist
.
name
].
append
(
dist
)
else
:
else
:
_cache_path_egg
[
dist
.
path
]
=
dist
_cache_path_egg
[
dist
.
path
]
=
dist
if
not
dist
.
name
in
_cache_name_egg
:
if
dist
.
name
not
in
_cache_name_egg
:
_cache_name_egg
[
dist
.
name
]
=
[]
_cache_name_egg
[
dist
.
name
]
=
[]
_cache_name_egg
[
dist
.
name
].
append
(
dist
)
_cache_name_egg
[
dist
.
name
].
append
(
dist
)
...
@@ -150,7 +150,7 @@ class Distribution:
...
@@ -150,7 +150,7 @@ class Distribution:
self
.
version
=
self
.
metadata
[
'Version'
]
self
.
version
=
self
.
metadata
[
'Version'
]
self
.
path
=
path
self
.
path
=
path
if
_cache_enabled
and
not
path
in
_cache_path
:
if
_cache_enabled
and
path
not
in
_cache_path
:
_cache_path
[
path
]
=
self
_cache_path
[
path
]
=
self
def
__repr__
(
self
):
def
__repr__
(
self
):
...
...
Lib/packaging/depgraph.py
View file @
e00a6703
...
@@ -58,7 +58,7 @@ class DependencyGraph:
...
@@ -58,7 +58,7 @@ class DependencyGraph:
"""
"""
self
.
adjacency_list
[
x
].
append
((
y
,
label
))
self
.
adjacency_list
[
x
].
append
((
y
,
label
))
# multiple edges are allowed, so be careful
# multiple edges are allowed, so be careful
if
not
x
in
self
.
reverse_list
[
y
]:
if
x
not
in
self
.
reverse_list
[
y
]:
self
.
reverse_list
[
y
].
append
(
x
)
self
.
reverse_list
[
y
].
append
(
x
)
def
add_missing
(
self
,
distribution
,
requirement
):
def
add_missing
(
self
,
distribution
,
requirement
):
...
@@ -72,7 +72,7 @@ class DependencyGraph:
...
@@ -72,7 +72,7 @@ class DependencyGraph:
self
.
missing
[
distribution
].
append
(
requirement
)
self
.
missing
[
distribution
].
append
(
requirement
)
def
_repr_dist
(
self
,
dist
):
def
_repr_dist
(
self
,
dist
):
return
'%
s
%s'
%
(
dist
.
name
,
dist
.
metadata
[
'Version'
])
return
'%
r
%s'
%
(
dist
.
name
,
dist
.
metadata
[
'Version'
])
def
repr_node
(
self
,
dist
,
level
=
1
):
def
repr_node
(
self
,
dist
,
level
=
1
):
"""Prints only a subgraph"""
"""Prints only a subgraph"""
...
@@ -154,10 +154,10 @@ def generate_graph(dists):
...
@@ -154,10 +154,10 @@ def generate_graph(dists):
if
len
(
comps
)
==
2
:
if
len
(
comps
)
==
2
:
version
=
comps
[
1
]
version
=
comps
[
1
]
if
len
(
version
)
<
3
or
version
[
0
]
!=
'('
or
version
[
-
1
]
!=
')'
:
if
len
(
version
)
<
3
or
version
[
0
]
!=
'('
or
version
[
-
1
]
!=
')'
:
raise
PackagingError
(
'
Distribution %s has ill formed'
\
raise
PackagingError
(
'
distribution %r has ill-formed'
'provides field: %
s
'
%
(
dist
.
name
,
p
))
'provides field: %
r
'
%
(
dist
.
name
,
p
))
version
=
version
[
1
:
-
1
]
# trim off parenthesis
version
=
version
[
1
:
-
1
]
# trim off parenthesis
if
n
ot
name
in
provided
:
if
n
ame
not
in
provided
:
provided
[
name
]
=
[]
provided
[
name
]
=
[]
provided
[
name
].
append
((
version
,
dist
))
provided
[
name
].
append
((
version
,
dist
))
...
@@ -174,7 +174,7 @@ def generate_graph(dists):
...
@@ -174,7 +174,7 @@ def generate_graph(dists):
name
=
predicate
.
name
name
=
predicate
.
name
if
n
ot
name
in
provided
:
if
n
ame
not
in
provided
:
graph
.
add_missing
(
dist
,
req
)
graph
.
add_missing
(
dist
,
req
)
else
:
else
:
matched
=
False
matched
=
False
...
@@ -204,8 +204,9 @@ def dependent_dists(dists, dist):
...
@@ -204,8 +204,9 @@ def dependent_dists(dists, dist):
:param dists: a list of distributions
:param dists: a list of distributions
:param dist: a distribution, member of *dists* for which we are interested
:param dist: a distribution, member of *dists* for which we are interested
"""
"""
if
not
dist
in
dists
:
if
dist
not
in
dists
:
raise
ValueError
(
'The given distribution is not a member of the list'
)
raise
ValueError
(
'given distribution %r is not a member of the list'
%
dist
.
name
)
graph
=
generate_graph
(
dists
)
graph
=
generate_graph
(
dists
)
dep
=
[
dist
]
# dependent distributions
dep
=
[
dist
]
# dependent distributions
...
@@ -215,7 +216,7 @@ def dependent_dists(dists, dist):
...
@@ -215,7 +216,7 @@ def dependent_dists(dists, dist):
node
=
fringe
.
pop
()
node
=
fringe
.
pop
()
dep
.
append
(
node
)
dep
.
append
(
node
)
for
prev
in
graph
.
reverse_list
[
node
]:
for
prev
in
graph
.
reverse_list
[
node
]:
if
not
prev
in
dep
:
if
prev
not
in
dep
:
fringe
.
append
(
prev
)
fringe
.
append
(
prev
)
dep
.
pop
(
0
)
# remove dist from dep, was there to prevent infinite loops
dep
.
pop
(
0
)
# remove dist from dep, was there to prevent infinite loops
...
@@ -236,17 +237,19 @@ def main():
...
@@ -236,17 +237,19 @@ def main():
except
Exception
as
e
:
except
Exception
as
e
:
tempout
.
seek
(
0
)
tempout
.
seek
(
0
)
tempout
=
tempout
.
read
()
tempout
=
tempout
.
read
()
print
(
'Could not generate the graph
\
n
%s
\
n
%s
\
n
'
%
(
tempout
,
e
))
print
(
'Could not generate the graph'
)
print
(
tempout
)
print
(
e
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
for
dist
,
reqs
in
graph
.
missing
.
items
():
for
dist
,
reqs
in
graph
.
missing
.
items
():
if
len
(
reqs
)
>
0
:
if
len
(
reqs
)
>
0
:
print
(
"Warning: Missing dependencies for %
s
:"
%
dist
.
name
,
print
(
"Warning: Missing dependencies for %
r
:"
%
dist
.
name
,
", "
.
join
(
reqs
))
", "
.
join
(
reqs
))
# XXX replace with argparse
# XXX replace with argparse
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
1
:
print
(
'Dependency graph:'
)
print
(
'Dependency graph:'
)
print
(
'
'
+
repr
(
graph
).
replace
(
'
\
n
'
,
'
\
n
'
))
print
(
'
'
,
repr
(
graph
).
replace
(
'
\
n
'
,
'
\
n
'
))
sys
.
exit
(
0
)
sys
.
exit
(
0
)
elif
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
in
(
'-d'
,
'--dot'
):
elif
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
]
in
(
'-d'
,
'--dot'
):
if
len
(
sys
.
argv
)
>
2
:
if
len
(
sys
.
argv
)
>
2
:
...
@@ -259,7 +262,7 @@ def main():
...
@@ -259,7 +262,7 @@ def main():
tempout
.
seek
(
0
)
tempout
.
seek
(
0
)
tempout
=
tempout
.
read
()
tempout
=
tempout
.
read
()
print
(
tempout
)
print
(
tempout
)
print
(
'Dot file written at
"%s"
'
%
filename
)
print
(
'Dot file written at
%r
'
%
filename
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
else
:
else
:
print
(
'Supported option: -d [filename]'
)
print
(
'Supported option: -d [filename]'
)
...
...
Lib/packaging/dist.py
View file @
e00a6703
...
@@ -509,14 +509,14 @@ Common commands: (see '--help-commands' for more)
...
@@ -509,14 +509,14 @@ Common commands: (see '--help-commands' for more)
options
=
self
.
global_options
options
=
self
.
global_options
parser
.
set_option_table
(
options
)
parser
.
set_option_table
(
options
)
parser
.
print_help
(
self
.
common_usage
+
"
\
n
Global options:"
)
parser
.
print_help
(
self
.
common_usage
+
"
\
n
Global options:"
)
print
(
''
)
print
()
if
display_options
:
if
display_options
:
parser
.
set_option_table
(
self
.
display_options
)
parser
.
set_option_table
(
self
.
display_options
)
parser
.
print_help
(
parser
.
print_help
(
"Information display options (just display "
+
"Information display options (just display "
+
"information, ignore any commands)"
)
"information, ignore any commands)"
)
print
(
''
)
print
()
for
command
in
self
.
commands
:
for
command
in
self
.
commands
:
if
isinstance
(
command
,
type
)
and
issubclass
(
command
,
Command
):
if
isinstance
(
command
,
type
)
and
issubclass
(
command
,
Command
):
...
@@ -529,7 +529,7 @@ Common commands: (see '--help-commands' for more)
...
@@ -529,7 +529,7 @@ Common commands: (see '--help-commands' for more)
else
:
else
:
parser
.
set_option_table
(
cls
.
user_options
)
parser
.
set_option_table
(
cls
.
user_options
)
parser
.
print_help
(
"Options for %r command:"
%
cls
.
__name__
)
parser
.
print_help
(
"Options for %r command:"
%
cls
.
__name__
)
print
(
''
)
print
()
print
(
gen_usage
(
self
.
script_name
))
print
(
gen_usage
(
self
.
script_name
))
...
@@ -544,7 +544,7 @@ Common commands: (see '--help-commands' for more)
...
@@ -544,7 +544,7 @@ Common commands: (see '--help-commands' for more)
# we ignore "foo bar").
# we ignore "foo bar").
if
self
.
help_commands
:
if
self
.
help_commands
:
self
.
print_commands
()
self
.
print_commands
()
print
(
''
)
print
()
print
(
gen_usage
(
self
.
script_name
))
print
(
gen_usage
(
self
.
script_name
))
return
1
return
1
...
...
Lib/packaging/pypi/dist.py
View file @
e00a6703
...
@@ -256,7 +256,7 @@ class DistInfo(IndexReference):
...
@@ -256,7 +256,7 @@ class DistInfo(IndexReference):
hashlib
.
new
(
hashname
)
hashlib
.
new
(
hashname
)
except
ValueError
:
except
ValueError
:
raise
UnsupportedHashName
(
hashname
)
raise
UnsupportedHashName
(
hashname
)
if
not
url
in
[
u
[
'url'
]
for
u
in
self
.
urls
]:
if
url
not
in
[
u
[
'url'
]
for
u
in
self
.
urls
]:
self
.
urls
.
append
({
self
.
urls
.
append
({
'url'
:
url
,
'url'
:
url
,
'hashname'
:
hashname
,
'hashname'
:
hashname
,
...
@@ -329,7 +329,7 @@ class DistInfo(IndexReference):
...
@@ -329,7 +329,7 @@ class DistInfo(IndexReference):
url param"""
url param"""
hashname
=
self
.
url
[
'hashname'
]
hashname
=
self
.
url
[
'hashname'
]
expected_hashval
=
self
.
url
[
'hashval'
]
expected_hashval
=
self
.
url
[
'hashval'
]
if
not
None
in
(
expected_hashval
,
hashname
):
if
None
not
in
(
expected_hashval
,
hashname
):
with
open
(
filename
,
'rb'
)
as
f
:
with
open
(
filename
,
'rb'
)
as
f
:
hashval
=
hashlib
.
new
(
hashname
)
hashval
=
hashlib
.
new
(
hashname
)
hashval
.
update
(
f
.
read
())
hashval
.
update
(
f
.
read
())
...
@@ -409,7 +409,7 @@ class ReleasesList(IndexReference):
...
@@ -409,7 +409,7 @@ class ReleasesList(IndexReference):
(
release
.
name
,
self
.
name
))
(
release
.
name
,
self
.
name
))
version
=
str
(
release
.
version
)
version
=
str
(
release
.
version
)
if
not
version
in
self
.
get_versions
():
if
version
not
in
self
.
get_versions
():
# append only if not already exists
# append only if not already exists
self
.
releases
.
append
(
release
)
self
.
releases
.
append
(
release
)
for
dist
in
release
.
dists
.
values
():
for
dist
in
release
.
dists
.
values
():
...
...
Lib/packaging/pypi/simple.py
View file @
e00a6703
...
@@ -231,7 +231,8 @@ class Crawler(BaseClient):
...
@@ -231,7 +231,8 @@ class Crawler(BaseClient):
"""
"""
self._mirrors_used.add(self.index_url)
self._mirrors_used.add(self.index_url)
index_url = self._mirrors.pop()
index_url = self._mirrors.pop()
if not ("
http
:
//
" or "
https
:
//
" or "
file
:
//
") in index_url:
# XXX use urllib.parse for a real check of missing scheme part
if not index_url.startswith(("
http
:
//
", "
https
:
//
", "
file
:
//
")):
index_url = "
http
:
//%
s
" % index_url
index_url = "
http
:
//%
s
" % index_url
if not index_url.endswith("
/
simple
"):
if not index_url.endswith("
/
simple
"):
...
@@ -282,7 +283,7 @@ class Crawler(BaseClient):
...
@@ -282,7 +283,7 @@ class Crawler(BaseClient):
name = release.name
name = release.name
else:
else:
name = release_info['name']
name = release_info['name']
if n
ot name.lower()
in self._projects:
if n
ame.lower() not
in self._projects:
self._projects[name.lower()] = ReleasesList(name, index=self._index)
self._projects[name.lower()] = ReleasesList(name, index=self._index)
if release:
if release:
...
@@ -320,7 +321,7 @@ class Crawler(BaseClient):
...
@@ -320,7 +321,7 @@ class Crawler(BaseClient):
# it's a distribution, so create a dist object
# it's a distribution, so create a dist object
try:
try:
infos = get_infos_from_url(link, project_name,
infos = get_infos_from_url(link, project_name,
is_external=
not self.index_url
in url)
is_external=
self.index_url not
in url)
except CantParseArchiveName as e:
except CantParseArchiveName as e:
if self.verbose:
if self.verbose:
logger.warning(
logger.warning(
...
...
Lib/packaging/run.py
View file @
e00a6703
...
@@ -286,9 +286,9 @@ def _metadata(dispatcher, args, **kw):
...
@@ -286,9 +286,9 @@ def _metadata(dispatcher, args, **kw):
value
=
metadata
[
key
]
value
=
metadata
[
key
]
if
isinstance
(
value
,
list
):
if
isinstance
(
value
,
list
):
for
v
in
value
:
for
v
in
value
:
print
(
'
'
+
v
)
print
(
'
'
,
v
)
else
:
else
:
print
(
'
'
+
value
.
replace
(
'
\
n
'
,
'
\
n
'
))
print
(
'
'
,
value
.
replace
(
'
\
n
'
,
'
\
n
'
))
@
action_help
(
remove_usage
)
@
action_help
(
remove_usage
)
...
@@ -366,7 +366,7 @@ def _list(dispatcher, args, **kw):
...
@@ -366,7 +366,7 @@ def _list(dispatcher, args, **kw):
print
(
'%s %s at %s'
%
(
dist
.
name
,
dist
.
metadata
[
'version'
],
dist
.
path
))
print
(
'%s %s at %s'
%
(
dist
.
name
,
dist
.
metadata
[
'version'
],
dist
.
path
))
number
+=
1
number
+=
1
print
(
''
)
print
()
if
number
==
0
:
if
number
==
0
:
print
(
'Nothing seems to be installed.'
)
print
(
'Nothing seems to be installed.'
)
else
:
else
:
...
@@ -405,7 +405,6 @@ class Dispatcher:
...
@@ -405,7 +405,6 @@ class Dispatcher:
self
.
verbose
=
1
self
.
verbose
=
1
self
.
dry_run
=
False
self
.
dry_run
=
False
self
.
help
=
False
self
.
help
=
False
self
.
script_name
=
'pysetup'
self
.
cmdclass
=
{}
self
.
cmdclass
=
{}
self
.
commands
=
[]
self
.
commands
=
[]
self
.
command_options
=
{}
self
.
command_options
=
{}
...
@@ -574,17 +573,17 @@ class Dispatcher:
...
@@ -574,17 +573,17 @@ class Dispatcher:
from
packaging.command.cmd
import
Command
from
packaging.command.cmd
import
Command
print
(
'Usage: pysetup [options] action [action_options]'
)
print
(
'Usage: pysetup [options] action [action_options]'
)
print
(
''
)
print
()
if
global_options_
:
if
global_options_
:
self
.
print_usage
(
self
.
parser
)
self
.
print_usage
(
self
.
parser
)
print
(
''
)
print
()
if
display_options_
:
if
display_options_
:
parser
.
set_option_table
(
display_options
)
parser
.
set_option_table
(
display_options
)
parser
.
print_help
(
parser
.
print_help
(
"Information display options (just display "
+
"Information display options (just display "
+
"information, ignore any commands)"
)
"information, ignore any commands)"
)
print
(
''
)
print
()
for
command
in
commands
:
for
command
in
commands
:
if
isinstance
(
command
,
type
)
and
issubclass
(
command
,
Command
):
if
isinstance
(
command
,
type
)
and
issubclass
(
command
,
Command
):
...
@@ -598,15 +597,15 @@ class Dispatcher:
...
@@ -598,15 +597,15 @@ class Dispatcher:
parser
.
set_option_table
(
cls
.
user_options
)
parser
.
set_option_table
(
cls
.
user_options
)
parser
.
print_help
(
"Options for %r command:"
%
cls
.
__name__
)
parser
.
print_help
(
"Options for %r command:"
%
cls
.
__name__
)
print
(
''
)
print
()
def
_show_command_help
(
self
,
command
):
def
_show_command_help
(
self
,
command
):
if
isinstance
(
command
,
str
):
if
isinstance
(
command
,
str
):
command
=
get_command_class
(
command
)
command
=
get_command_class
(
command
)
desc
=
getattr
(
command
,
'description'
,
'(no description available)'
)
desc
=
getattr
(
command
,
'description'
,
'(no description available)'
)
print
(
'Description:
%s'
%
desc
)
print
(
'Description:
'
,
desc
)
print
(
''
)
print
()
if
(
hasattr
(
command
,
'help_options'
)
and
if
(
hasattr
(
command
,
'help_options'
)
and
isinstance
(
command
.
help_options
,
list
)):
isinstance
(
command
.
help_options
,
list
)):
...
@@ -616,7 +615,7 @@ class Dispatcher:
...
@@ -616,7 +615,7 @@ class Dispatcher:
self
.
parser
.
set_option_table
(
command
.
user_options
)
self
.
parser
.
set_option_table
(
command
.
user_options
)
self
.
parser
.
print_help
(
"Options:"
)
self
.
parser
.
print_help
(
"Options:"
)
print
(
''
)
print
()
def
_get_command_groups
(
self
):
def
_get_command_groups
(
self
):
"""Helper function to retrieve all the command class names divided
"""Helper function to retrieve all the command class names divided
...
...
Lib/packaging/tests/test_command_bdist_dumb.py
View file @
e00a6703
...
@@ -49,7 +49,6 @@ class BuildDumbTestCase(support.TempdirManager,
...
@@ -49,7 +49,6 @@ class BuildDumbTestCase(support.TempdirManager,
'py_modules'
:
[
'foo'
],
'py_modules'
:
[
'foo'
],
'url'
:
'xxx'
,
'author'
:
'xxx'
,
'url'
:
'xxx'
,
'author'
:
'xxx'
,
'author_email'
:
'xxx'
})
'author_email'
:
'xxx'
})
dist
.
script_name
=
'setup.py'
os
.
chdir
(
pkg_dir
)
os
.
chdir
(
pkg_dir
)
sys
.
argv
[:]
=
[
'setup.py'
]
sys
.
argv
[:]
=
[
'setup.py'
]
...
...
Lib/packaging/tests/test_command_build_py.py
View file @
e00a6703
...
@@ -33,9 +33,7 @@ class BuildPyTestCase(support.TempdirManager,
...
@@ -33,9 +33,7 @@ class BuildPyTestCase(support.TempdirManager,
dist
=
Distribution
({
"packages"
:
[
"pkg"
],
dist
=
Distribution
({
"packages"
:
[
"pkg"
],
"package_dir"
:
sources
})
"package_dir"
:
sources
})
# script_name need not exist, it just need to be initialized
dist
.
script_name
=
os
.
path
.
join
(
sources
,
"setup.py"
)
dist
.
command_obj
[
"build"
]
=
support
.
DummyCommand
(
dist
.
command_obj
[
"build"
]
=
support
.
DummyCommand
(
force
=
False
,
force
=
False
,
build_lib
=
destination
,
build_lib
=
destination
,
...
@@ -89,8 +87,6 @@ class BuildPyTestCase(support.TempdirManager,
...
@@ -89,8 +87,6 @@ class BuildPyTestCase(support.TempdirManager,
dist
=
Distribution
({
"packages"
:
[
"pkg"
],
dist
=
Distribution
({
"packages"
:
[
"pkg"
],
"package_dir"
:
sources
,
"package_dir"
:
sources
,
"package_data"
:
{
"pkg"
:
[
"doc/*"
]}})
"package_data"
:
{
"pkg"
:
[
"doc/*"
]}})
# script_name need not exist, it just need to be initialized
dist
.
script_name
=
os
.
path
.
join
(
sources
,
"setup.py"
)
dist
.
script_args
=
[
"build"
]
dist
.
script_args
=
[
"build"
]
dist
.
parse_command_line
()
dist
.
parse_command_line
()
...
...
Lib/packaging/tests/test_command_install_dist.py
View file @
e00a6703
...
@@ -30,8 +30,6 @@ class InstallTestCase(support.TempdirManager,
...
@@ -30,8 +30,6 @@ class InstallTestCase(support.TempdirManager,
destination
=
os
.
path
.
join
(
builddir
,
"installation"
)
destination
=
os
.
path
.
join
(
builddir
,
"installation"
)
dist
=
Distribution
({
"name"
:
"foopkg"
})
dist
=
Distribution
({
"name"
:
"foopkg"
})
# script_name need not exist, it just need to be initialized
dist
.
script_name
=
os
.
path
.
join
(
builddir
,
"setup.py"
)
dist
.
command_obj
[
"build"
]
=
support
.
DummyCommand
(
dist
.
command_obj
[
"build"
]
=
support
.
DummyCommand
(
build_base
=
builddir
,
build_base
=
builddir
,
build_lib
=
os
.
path
.
join
(
builddir
,
"lib"
),
build_lib
=
os
.
path
.
join
(
builddir
,
"lib"
),
...
...
Lib/packaging/tests/test_command_install_lib.py
View file @
e00a6703
...
@@ -65,7 +65,6 @@ class InstallLibTestCase(support.TempdirManager,
...
@@ -65,7 +65,6 @@ class InstallLibTestCase(support.TempdirManager,
self
.
write_file
(
f
,
'# python package'
)
self
.
write_file
(
f
,
'# python package'
)
cmd
.
distribution
.
ext_modules
=
[
Extension
(
'foo'
,
[
'xxx'
])]
cmd
.
distribution
.
ext_modules
=
[
Extension
(
'foo'
,
[
'xxx'
])]
cmd
.
distribution
.
packages
=
[
pkg_dir
]
cmd
.
distribution
.
packages
=
[
pkg_dir
]
cmd
.
distribution
.
script_name
=
'setup.py'
# make sure the build_lib is set the temp dir
# make sure the build_lib is set the temp dir
build_dir
=
os
.
path
.
split
(
pkg_dir
)[
0
]
build_dir
=
os
.
path
.
split
(
pkg_dir
)[
0
]
...
@@ -86,7 +85,6 @@ class InstallLibTestCase(support.TempdirManager,
...
@@ -86,7 +85,6 @@ class InstallLibTestCase(support.TempdirManager,
self
.
write_file
(
f
,
'# python package'
)
self
.
write_file
(
f
,
'# python package'
)
cmd
.
distribution
.
ext_modules
=
[
Extension
(
'foo'
,
[
'xxx'
])]
cmd
.
distribution
.
ext_modules
=
[
Extension
(
'foo'
,
[
'xxx'
])]
cmd
.
distribution
.
packages
=
[
pkg_dir
]
cmd
.
distribution
.
packages
=
[
pkg_dir
]
cmd
.
distribution
.
script_name
=
'setup.py'
# get_input should return 2 elements
# get_input should return 2 elements
self
.
assertEqual
(
len
(
cmd
.
get_inputs
()),
2
)
self
.
assertEqual
(
len
(
cmd
.
get_inputs
()),
2
)
...
...
Lib/packaging/tests/test_command_sdist.py
View file @
e00a6703
...
@@ -24,12 +24,6 @@ from packaging.util import find_executable
...
@@ -24,12 +24,6 @@ from packaging.util import find_executable
from
packaging.tests
import
support
from
packaging.tests
import
support
from
shutil
import
get_archive_formats
from
shutil
import
get_archive_formats
SETUP_PY
=
"""
from packaging.core import setup
import somecode
setup(name='fake')
"""
MANIFEST
=
"""
\
MANIFEST
=
"""
\
# file GENERATED by packaging, do NOT edit
# file GENERATED by packaging, do NOT edit
...
@@ -57,8 +51,6 @@ class SDistTestCase(support.TempdirManager,
...
@@ -57,8 +51,6 @@ class SDistTestCase(support.TempdirManager,
restore_environ
=
[
'HOME'
]
restore_environ
=
[
'HOME'
]
def
setUp
(
self
):
def
setUp
(
self
):
# PyPIRCCommandTestCase creates a temp dir already
# and put it in self.tmp_dir
super
(
SDistTestCase
,
self
).
setUp
()
super
(
SDistTestCase
,
self
).
setUp
()
self
.
tmp_dir
=
self
.
mkdtemp
()
self
.
tmp_dir
=
self
.
mkdtemp
()
os
.
environ
[
'HOME'
]
=
self
.
tmp_dir
os
.
environ
[
'HOME'
]
=
self
.
tmp_dir
...
@@ -69,7 +61,6 @@ class SDistTestCase(support.TempdirManager,
...
@@ -69,7 +61,6 @@ class SDistTestCase(support.TempdirManager,
# a package, and a README
# a package, and a README
self
.
write_file
((
self
.
tmp_dir
,
'README'
),
'xxx'
)
self
.
write_file
((
self
.
tmp_dir
,
'README'
),
'xxx'
)
self
.
write_file
((
self
.
tmp_dir
,
'somecode'
,
'__init__.py'
),
'#'
)
self
.
write_file
((
self
.
tmp_dir
,
'somecode'
,
'__init__.py'
),
'#'
)
self
.
write_file
((
self
.
tmp_dir
,
'setup.py'
),
SETUP_PY
)
os
.
chdir
(
self
.
tmp_dir
)
os
.
chdir
(
self
.
tmp_dir
)
def
tearDown
(
self
):
def
tearDown
(
self
):
...
@@ -84,7 +75,6 @@ class SDistTestCase(support.TempdirManager,
...
@@ -84,7 +75,6 @@ class SDistTestCase(support.TempdirManager,
'url'
:
'xxx'
,
'author'
:
'xxx'
,
'url'
:
'xxx'
,
'author'
:
'xxx'
,
'author_email'
:
'xxx'
}
'author_email'
:
'xxx'
}
dist
=
Distribution
(
metadata
)
dist
=
Distribution
(
metadata
)
dist
.
script_name
=
'setup.py'
dist
.
packages
=
[
'somecode'
]
dist
.
packages
=
[
'somecode'
]
dist
.
include_package_data
=
True
dist
.
include_package_data
=
True
cmd
=
sdist
(
dist
)
cmd
=
sdist
(
dist
)
...
...
Lib/packaging/tests/test_config.py
View file @
e00a6703
...
@@ -114,7 +114,7 @@ libraries = gecodeint gecodekernel -- sys.platform != 'win32'
...
@@ -114,7 +114,7 @@ libraries = gecodeint gecodekernel -- sys.platform != 'win32'
GecodeInt GecodeKernel -- sys.platform == 'win32'
GecodeInt GecodeKernel -- sys.platform == 'win32'
[extension=fast_taunt]
[extension=fast_taunt]
name = t
hree
.fast_taunt
name = t
wo
.fast_taunt
sources = cxx_src/utils_taunt.cxx
sources = cxx_src/utils_taunt.cxx
cxx_src/python_module.cxx
cxx_src/python_module.cxx
include_dirs = /usr/include/gecode
include_dirs = /usr/include/gecode
...
@@ -305,7 +305,7 @@ class ConfigTestCase(support.TempdirManager,
...
@@ -305,7 +305,7 @@ class ConfigTestCase(support.TempdirManager,
self
.
assertEqual
(
ext
.
extra_link_args
,
self
.
assertEqual
(
ext
.
extra_link_args
,
[
'`gcc -print-file-name=libgcc.a`'
,
'-shared'
])
[
'`gcc -print-file-name=libgcc.a`'
,
'-shared'
])
ext
=
ext_modules
.
get
(
't
hree
.fast_taunt'
)
ext
=
ext_modules
.
get
(
't
wo
.fast_taunt'
)
self
.
assertEqual
(
ext
.
sources
,
self
.
assertEqual
(
ext
.
sources
,
[
'cxx_src/utils_taunt.cxx'
,
'cxx_src/python_module.cxx'
])
[
'cxx_src/utils_taunt.cxx'
,
'cxx_src/python_module.cxx'
])
self
.
assertEqual
(
ext
.
include_dirs
,
self
.
assertEqual
(
ext
.
include_dirs
,
...
...
Lib/packaging/util.py
View file @
e00a6703
...
@@ -1099,7 +1099,7 @@ def ask(message, options):
...
@@ -1099,7 +1099,7 @@ def ask(message, options):
response
=
input
(
message
)
response
=
input
(
message
)
response
=
response
.
strip
().
lower
()
response
=
response
.
strip
().
lower
()
if
response
not
in
options
:
if
response
not
in
options
:
print
(
'invalid response:
%r'
%
response
)
print
(
'invalid response:
'
,
repr
(
response
)
)
print
(
'choose one of'
,
', '
.
join
(
repr
(
o
)
for
o
in
options
))
print
(
'choose one of'
,
', '
.
join
(
repr
(
o
)
for
o
in
options
))
else
:
else
:
return
response
return
response
...
...
setup.py
View file @
e00a6703
...
@@ -1780,6 +1780,13 @@ class PyBuildInstall(install):
...
@@ -1780,6 +1780,13 @@ class PyBuildInstall(install):
install
.
initialize_options
(
self
)
install
.
initialize_options
(
self
)
self
.
warn_dir
=
0
self
.
warn_dir
=
0
# Customize subcommands to not install an egg-info file for Python
sub_commands
=
[(
'install_lib'
,
install
.
has_lib
),
(
'install_headers'
,
install
.
has_headers
),
(
'install_scripts'
,
install
.
has_scripts
),
(
'install_data'
,
install
.
has_data
)]
class
PyBuildInstallLib
(
install_lib
):
class
PyBuildInstallLib
(
install_lib
):
# Do exactly what install_lib does but make sure correct access modes get
# Do exactly what install_lib does but make sure correct access modes get
# set on installed directories and files. All installed files with get
# set on installed directories and files. All installed files with get
...
...
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