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
4951f232
Commit
4951f232
authored
Jun 02, 2007
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport 55731:
SF 1668596/1720897: distutils now copies data files even if package_dir is empty.
parent
00863401
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
command/build_py.py
command/build_py.py
+3
-1
tests/test_build_py.py
tests/test_build_py.py
+35
-0
No files found.
command/build_py.py
View file @
4951f232
...
...
@@ -114,7 +114,9 @@ class build_py (Command):
build_dir
=
os
.
path
.
join
(
*
([
self
.
build_lib
]
+
package
.
split
(
'.'
)))
# Length of path to strip from found files
plen
=
len
(
src_dir
)
+
1
plen
=
0
if
src_dir
:
plen
=
len
(
src_dir
)
+
1
# Strip directory from globbed filenames
filenames
=
[
...
...
tests/test_build_py.py
View file @
4951f232
"""Tests for distutils.command.build_py."""
import
os
import
sys
import
StringIO
import
unittest
from
distutils.command.build_py
import
build_py
from
distutils.core
import
Distribution
from
distutils.errors
import
DistutilsFileError
from
distutils.tests
import
support
...
...
@@ -53,6 +56,38 @@ class BuildPyTestCase(support.TempdirManager,
self
.
assert_
(
"__init__.pyc"
in
files
)
self
.
assert_
(
"README.txt"
in
files
)
def
test_empty_package_dir
(
self
):
# See SF 1668596/1720897.
cwd
=
os
.
getcwd
()
# create the distribution files.
sources
=
self
.
mkdtemp
()
open
(
os
.
path
.
join
(
sources
,
"__init__.py"
),
"w"
).
close
()
testdir
=
os
.
path
.
join
(
sources
,
"doc"
)
os
.
mkdir
(
testdir
)
open
(
os
.
path
.
join
(
testdir
,
"testfile"
),
"w"
).
close
()
os
.
chdir
(
sources
)
sys
.
stdout
=
StringIO
.
StringIO
()
try
:
dist
=
Distribution
({
"packages"
:
[
"pkg"
],
"package_dir"
:
{
"pkg"
:
""
},
"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
.
parse_command_line
()
try
:
dist
.
run_commands
()
except
DistutilsFileError
:
self
.
fail
(
"failed package_data test when package_dir is ''"
)
finally
:
# Restore state.
os
.
chdir
(
cwd
)
sys
.
stdout
=
sys
.
__stdout__
def
test_suite
():
return
unittest
.
makeSuite
(
BuildPyTestCase
)
...
...
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