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
d139b994
Commit
d139b994
authored
Oct 14, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix writing of the RESOURCES file by packaging (#12386)
parent
f598d60b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
6 deletions
+62
-6
Lib/packaging/command/install_distinfo.py
Lib/packaging/command/install_distinfo.py
+1
-1
Lib/packaging/tests/test_command_install_data.py
Lib/packaging/tests/test_command_install_data.py
+54
-3
Lib/packaging/tests/test_command_install_distinfo.py
Lib/packaging/tests/test_command_install_distinfo.py
+4
-1
Misc/NEWS
Misc/NEWS
+3
-1
No files found.
Lib/packaging/command/install_distinfo.py
View file @
d139b994
...
...
@@ -104,7 +104,7 @@ class install_distinfo(Command):
'RESOURCES'
)
logger
.
info
(
'creating %s'
,
resources_path
)
if
not
self
.
dry_run
:
with
open
(
resources_path
,
'w
b
'
)
as
f
:
with
open
(
resources_path
,
'w'
)
as
f
:
writer
=
csv
.
writer
(
f
,
delimiter
=
','
,
lineterminator
=
'
\
n
'
,
quotechar
=
'"'
)
...
...
Lib/packaging/tests/test_command_install_data.py
View file @
d139b994
"""Tests for packaging.command.install_data."""
import
os
import
sys
import
sysconfig
import
packaging.database
from
sysconfig
import
_get_default_scheme
from
packaging.tests
import
unittest
,
support
from
packaging.command.install_data
import
install_data
from
packaging.command.install_dist
import
install_dist
from
packaging.command.install_distinfo
import
install_distinfo
class
InstallDataTestCase
(
support
.
TempdirManager
,
support
.
LoggingCatcher
,
unittest
.
TestCase
):
def
test_simple_run
(
self
):
def
setUp
(
self
):
super
(
InstallDataTestCase
,
self
).
setUp
()
scheme
=
_get_default_scheme
()
old_items
=
sysconfig
.
_SCHEMES
.
items
(
scheme
)
def
restore
():
sysconfig
.
_SCHEMES
.
remove_section
(
scheme
)
sysconfig
.
_SCHEMES
.
add_section
(
scheme
)
for
option
,
value
in
old_items
:
sysconfig
.
_SCHEMES
.
set
(
scheme
,
option
,
value
)
self
.
addCleanup
(
restore
)
def
test_simple_run
(
self
):
pkg_dir
,
dist
=
self
.
create_dist
()
cmd
=
install_data
(
dist
)
cmd
.
install_dir
=
inst
=
os
.
path
.
join
(
pkg_dir
,
'inst'
)
scheme
=
_get_default_scheme
()
sysconfig
.
_SCHEMES
.
set
(
scheme
,
'inst'
,
os
.
path
.
join
(
pkg_dir
,
'inst'
))
...
...
@@ -67,8 +76,7 @@ class InstallDataTestCase(support.TempdirManager,
three
=
os
.
path
.
join
(
cmd
.
install_dir
,
'three'
)
self
.
write_file
(
three
,
'xx'
)
sysconfig
.
_SCHEMES
.
set
(
scheme
,
'inst3'
,
cmd
.
install_dir
)
sysconfig
.
_SCHEMES
.
set
(
scheme
,
'inst3'
,
cmd
.
install_dir
)
cmd
.
data_files
=
{
one
:
'{inst}/one'
,
two
:
'{inst2}/two'
,
three
:
'{inst3}/three'
}
...
...
@@ -80,6 +88,49 @@ class InstallDataTestCase(support.TempdirManager,
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst2
,
rtwo
)))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
inst
,
rone
)))
def
test_resources
(
self
):
install_dir
=
self
.
mkdtemp
()
scripts_dir
=
self
.
mkdtemp
()
project_dir
,
dist
=
self
.
create_dist
(
name
=
'Spamlib'
,
version
=
'0.1'
,
data_files
=
{
'spamd'
:
'{scripts}/spamd'
})
os
.
chdir
(
project_dir
)
self
.
write_file
(
'spamd'
,
'# Python script'
)
sysconfig
.
_SCHEMES
.
set
(
_get_default_scheme
(),
'scripts'
,
scripts_dir
)
sys
.
path
.
insert
(
0
,
install_dir
)
self
.
addCleanup
(
sys
.
path
.
remove
,
install_dir
)
cmd
=
install_dist
(
dist
)
cmd
.
outputs
=
[
'spamd'
]
cmd
.
install_lib
=
install_dir
dist
.
command_obj
[
'install_dist'
]
=
cmd
cmd
=
install_data
(
dist
)
cmd
.
install_dir
=
install_dir
cmd
.
ensure_finalized
()
dist
.
command_obj
[
'install_data'
]
=
cmd
cmd
.
run
()
cmd
=
install_distinfo
(
dist
)
cmd
.
ensure_finalized
()
dist
.
command_obj
[
'install_distinfo'
]
=
cmd
cmd
.
run
()
fn
=
os
.
path
.
join
(
install_dir
,
'Spamlib-0.1.dist-info'
,
'RESOURCES'
)
with
open
(
fn
,
encoding
=
'utf-8'
)
as
fp
:
content
=
fp
.
read
().
strip
()
expected
=
'spamd,%s'
%
os
.
path
.
join
(
scripts_dir
,
'spamd'
)
self
.
assertEqual
(
content
,
expected
)
# just to be sure, we also test that get_file works here, even though
# packaging.database has its own test file
with
packaging
.
database
.
get_file
(
'Spamlib'
,
'spamd'
)
as
fp
:
content
=
fp
.
read
()
self
.
assertEqual
(
'# Python script'
,
content
)
def
test_suite
():
return
unittest
.
makeSuite
(
InstallDataTestCase
)
...
...
Lib/packaging/tests/test_command_install_distinfo.py
View file @
d139b994
"""Tests for ``packaging.command.install_distinfo``. """
"""Tests for ``packaging.command.install_distinfo``.
Writing of the RESOURCES file is tested in test_command_install_data.
"""
import
os
import
csv
...
...
Misc/NEWS
View file @
d139b994
...
...
@@ -12,7 +12,7 @@ Core and Builtins
- PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
- Add internal API for static strings (_Py_identifier et
.
al.).
- Add internal API for static strings (_Py_identifier et
al.).
- Issue #13063: the Windows error ERROR_NO_DATA (numbered 232 and described
as "The pipe is being closed") is now mapped to POSIX errno EPIPE
...
...
@@ -304,6 +304,8 @@ Core and Builtins
Library
-------
-
Issue
#
12386
:
packaging
does
not
fail
anymore
when
writing
the
RESOURCES
file
.
-
Issue
#
13158
:
Fix
decoding
and
encoding
of
GNU
tar
specific
base
-
256
number
fields
in
tarfile
.
...
...
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