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
133543d7
Commit
133543d7
authored
Dec 08, 2012
by
Éric Araujo
Browse files
Options
Browse Files
Download
Plain Diff
Merge fixes for #13614, #13512 and #7719 from 3.2
parents
285e4e10
1bf87508
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
29 deletions
+51
-29
command/check.py
command/check.py
+3
-0
config.py
config.py
+1
-10
dir_util.py
dir_util.py
+4
-0
tests/test_dir_util.py
tests/test_dir_util.py
+16
-5
tests/test_register.py
tests/test_register.py
+23
-11
tests/test_sdist.py
tests/test_sdist.py
+4
-3
No files found.
command/check.py
View file @
133543d7
...
...
@@ -23,6 +23,9 @@ try:
def
system_message
(
self
,
level
,
message
,
*
children
,
**
kwargs
):
self
.
messages
.
append
((
level
,
message
,
children
,
kwargs
))
return
nodes
.
system_message
(
message
,
level
=
level
,
type
=
self
.
levels
[
level
],
*
children
,
**
kwargs
)
HAS_DOCUTILS
=
True
except
Exception
:
...
...
config.py
View file @
133543d7
...
...
@@ -4,7 +4,6 @@ Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
import
os
import
sys
from
configparser
import
ConfigParser
from
distutils.cmd
import
Command
...
...
@@ -43,16 +42,8 @@ class PyPIRCCommand(Command):
def
_store_pypirc
(
self
,
username
,
password
):
"""Creates a default .pypirc file."""
rc
=
self
.
_get_rc_file
()
f
=
open
(
rc
,
'w'
)
try
:
with
os
.
fdopen
(
os
.
open
(
rc
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
0o600
),
'w'
)
as
f
:
f
.
write
(
DEFAULT_PYPIRC
%
(
username
,
password
))
finally
:
f
.
close
()
try
:
os
.
chmod
(
rc
,
0o600
)
except
OSError
:
# should do something better here
pass
def
_read_pypirc
(
self
):
"""Reads the .pypirc file."""
...
...
dir_util.py
View file @
133543d7
...
...
@@ -141,6 +141,10 @@ def copy_tree(src, dst, preserve_mode=1, preserve_times=1,
src_name
=
os
.
path
.
join
(
src
,
n
)
dst_name
=
os
.
path
.
join
(
dst
,
n
)
if
n
.
startswith
(
'.nfs'
):
# skip NFS rename files
continue
if
preserve_symlinks
and
os
.
path
.
islink
(
src_name
):
link_dest
=
os
.
readlink
(
src_name
)
if
verbose
>=
1
:
...
...
tests/test_dir_util.py
View file @
133543d7
...
...
@@ -76,7 +76,6 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
remove_tree
(
self
.
root_target
,
verbose
=
0
)
def
test_copy_tree_verbosity
(
self
):
mkpath
(
self
.
target
,
verbose
=
0
)
...
...
@@ -88,11 +87,8 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
mkpath
(
self
.
target
,
verbose
=
0
)
a_file
=
os
.
path
.
join
(
self
.
target
,
'ok.txt'
)
f
=
open
(
a_file
,
'w'
)
try
:
with
open
(
a_file
,
'w'
)
as
f
:
f
.
write
(
'some content'
)
finally
:
f
.
close
()
wanted
=
[
'copying %s -> %s'
%
(
a_file
,
self
.
target2
)]
copy_tree
(
self
.
target
,
self
.
target2
,
verbose
=
1
)
...
...
@@ -101,6 +97,21 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
remove_tree
(
self
.
root_target
,
verbose
=
0
)
remove_tree
(
self
.
target2
,
verbose
=
0
)
def
test_copy_tree_skips_nfs_temp_files
(
self
):
mkpath
(
self
.
target
,
verbose
=
0
)
a_file
=
os
.
path
.
join
(
self
.
target
,
'ok.txt'
)
nfs_file
=
os
.
path
.
join
(
self
.
target
,
'.nfs123abc'
)
for
f
in
a_file
,
nfs_file
:
with
open
(
f
,
'w'
)
as
fh
:
fh
.
write
(
'some content'
)
copy_tree
(
self
.
target
,
self
.
target2
)
self
.
assertEqual
(
os
.
listdir
(
self
.
target2
),
[
'ok.txt'
])
remove_tree
(
self
.
root_target
,
verbose
=
0
)
remove_tree
(
self
.
target2
,
verbose
=
0
)
def
test_ensure_relative
(
self
):
if
os
.
sep
==
'/'
:
self
.
assertEqual
(
ensure_relative
(
'/home/foo'
),
'home/foo'
)
...
...
tests/test_register.py
View file @
133543d7
"""Tests for distutils.command.register."""
import
sys
import
os
import
unittest
import
getpass
...
...
@@ -10,11 +9,14 @@ from test.support import check_warnings, run_unittest
from
distutils.command
import
register
as
register_module
from
distutils.command.register
import
register
from
distutils.core
import
Distribution
from
distutils.errors
import
DistutilsSetupError
from
distutils.tests
import
support
from
distutils.tests.test_config
import
PYPIRC
,
PyPIRCCommandTestCase
from
distutils.tests.test_config
import
PyPIRCCommandTestCase
try
:
import
docutils
except
ImportError
:
docutils
=
None
PYPIRC_NOPASSWORD
=
"""
\
[distutils]
...
...
@@ -193,6 +195,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
self
.
assertEqual
(
headers
[
'Content-length'
],
'290'
)
self
.
assertTrue
((
b'tarek'
)
in
req
.
data
)
@
unittest
.
skipUnless
(
docutils
is
not
None
,
'needs docutils'
)
def
test_strict
(
self
):
# testing the script option
# when on, the register command stops if
...
...
@@ -205,13 +208,6 @@ class RegisterTestCase(PyPIRCCommandTestCase):
cmd
.
strict
=
1
self
.
assertRaises
(
DistutilsSetupError
,
cmd
.
run
)
# we don't test the reSt feature if docutils
# is not installed
try
:
import
docutils
except
ImportError
:
return
# metadata are OK but long_description is broken
metadata
=
{
'url'
:
'xxx'
,
'author'
:
'xxx'
,
'author_email'
:
'éxéxé'
,
...
...
@@ -265,6 +261,22 @@ class RegisterTestCase(PyPIRCCommandTestCase):
finally
:
del
register_module
.
input
@
unittest
.
skipUnless
(
docutils
is
not
None
,
'needs docutils'
)
def
test_register_invalid_long_description
(
self
):
description
=
':funkie:`str`'
# mimic Sphinx-specific markup
metadata
=
{
'url'
:
'xxx'
,
'author'
:
'xxx'
,
'author_email'
:
'xxx'
,
'name'
:
'xxx'
,
'version'
:
'xxx'
,
'long_description'
:
description
}
cmd
=
self
.
_get_cmd
(
metadata
)
cmd
.
ensure_finalized
()
cmd
.
strict
=
True
inputs
=
Inputs
(
'2'
,
'tarek'
,
'tarek@ziade.org'
)
register_module
.
input
=
inputs
self
.
addCleanup
(
delattr
,
register_module
,
'input'
)
self
.
assertRaises
(
DistutilsSetupError
,
cmd
.
run
)
def
test_check_metadata_deprecated
(
self
):
# makes sure make_metadata is deprecated
cmd
=
self
.
_get_cmd
()
...
...
tests/test_sdist.py
View file @
133543d7
...
...
@@ -83,9 +83,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
@
unittest
.
skipUnless
(
ZLIB_SUPPORT
,
'Need zlib support to run'
)
def
test_prune_file_list
(
self
):
# this test creates a package with some vcs dirs in it
# and launch sdist to make sure they get pruned
# on all systems
# this test creates a project with some VCS dirs and an NFS rename
# file, then launches sdist to check they get pruned on all systems
# creating VCS directories with some files in them
os
.
mkdir
(
join
(
self
.
tmp_dir
,
'somecode'
,
'.svn'
))
...
...
@@ -99,6 +98,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
self
.
write_file
((
self
.
tmp_dir
,
'somecode'
,
'.git'
,
'ok'
),
'xxx'
)
self
.
write_file
((
self
.
tmp_dir
,
'somecode'
,
'.nfs0001'
),
'xxx'
)
# now building a sdist
dist
,
cmd
=
self
.
get_cmd
()
...
...
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