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
681c04f6
Commit
681c04f6
authored
Feb 17, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2279 added the plain path case for data_files
parent
25e6f089
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
command/sdist.py
command/sdist.py
+12
-4
tests/test_sdist.py
tests/test_sdist.py
+11
-3
No files found.
command/sdist.py
View file @
681c04f6
...
...
@@ -14,7 +14,7 @@ from distutils.text_file import TextFile
from
distutils.errors
import
*
from
distutils.filelist
import
FileList
from
distutils
import
log
from
distutils.util
import
convert_path
def
show_formats
():
"""Print all possible values for the 'formats' option (used by
...
...
@@ -311,9 +311,17 @@ class sdist (Command):
# getting distribution.data_files
if
self
.
distribution
.
has_data_files
():
for
dirname
,
filenames
in
self
.
distribution
.
data_files
:
for
filename
in
filenames
:
self
.
filelist
.
append
(
os
.
path
.
join
(
dirname
,
filename
))
for
item
in
self
.
distribution
.
data_files
:
if
isinstance
(
item
,
str
):
# plain file
item
=
convert_path
(
item
)
if
os
.
path
.
isfile
(
item
):
self
.
filelist
.
append
(
item
)
else
:
# a (dirname, filenames) tuple
dirname
,
filenames
=
item
for
f
in
filenames
:
f
=
convert_path
(
os
.
path
.
join
(
dirname
,
f
))
if
os
.
path
.
isfile
(
f
):
self
.
filelist
.
append
(
f
)
if
self
.
distribution
.
has_ext_modules
():
build_ext
=
self
.
get_finalized_command
(
'build_ext'
)
...
...
tests/test_sdist.py
View file @
681c04f6
...
...
@@ -26,6 +26,8 @@ README
setup.py
data%(sep)sdata.dt
scripts%(sep)sscript.py
some%(sep)sfile.txt
some%(sep)sother_file.txt
somecode%(sep)s__init__.py
somecode%(sep)sdoc.dat
somecode%(sep)sdoc.txt
...
...
@@ -167,7 +169,14 @@ class sdistTestCase(support.LoggingSilencer, PyPIRCCommandTestCase):
data_dir
=
join
(
self
.
tmp_dir
,
'data'
)
os
.
mkdir
(
data_dir
)
self
.
write_file
((
data_dir
,
'data.dt'
),
'#'
)
dist
.
data_files
=
[(
'data'
,
[
'data.dt'
])]
some_dir
=
join
(
self
.
tmp_dir
,
'some'
)
os
.
mkdir
(
some_dir
)
self
.
write_file
((
some_dir
,
'file.txt'
),
'#'
)
self
.
write_file
((
some_dir
,
'other_file.txt'
),
'#'
)
dist
.
data_files
=
[(
'data'
,
[
'data.dt'
,
'notexisting'
]),
'some/file.txt'
,
'some/other_file.txt'
]
# adding a script
script_dir
=
join
(
self
.
tmp_dir
,
'scripts'
)
...
...
@@ -175,7 +184,6 @@ class sdistTestCase(support.LoggingSilencer, PyPIRCCommandTestCase):
self
.
write_file
((
script_dir
,
'script.py'
),
'#'
)
dist
.
scripts
=
[
join
(
'scripts'
,
'script.py'
)]
cmd
.
formats
=
[
'zip'
]
cmd
.
use_defaults
=
True
...
...
@@ -194,7 +202,7 @@ class sdistTestCase(support.LoggingSilencer, PyPIRCCommandTestCase):
zip_file
.
close
()
# making sure everything was added
self
.
assertEquals
(
len
(
content
),
8
)
self
.
assertEquals
(
len
(
content
),
10
)
# checking the MANIFEST
manifest
=
open
(
join
(
self
.
tmp_dir
,
'MANIFEST'
)).
read
()
...
...
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