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
9f1f9b14
Commit
9f1f9b14
authored
Feb 11, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge backout of namespace package __init__ module generation; ref #148.
parents
4104aa38
911fe5e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
27 deletions
+7
-27
CHANGES.txt
CHANGES.txt
+4
-0
setuptools/command/bdist_egg.py
setuptools/command/bdist_egg.py
+3
-27
No files found.
CHANGES.txt
View file @
9f1f9b14
...
...
@@ -14,6 +14,10 @@ CHANGES
handled properly at runtime. In 2.x it was possible to get away without
including the declaration, but only at the cost of forcing namespace
packages to be imported early, which 3.0 no longer does.
* Issue #148: When building (bdist_egg), setuptools no longer adds
``__init__.py`` files to namespace packages. Any packages that rely on this
behavior will need to create ``__init__.py`` files and include the
``declare_namespace()``.
* Issue #7: Setuptools itself is now distributed as a zip archive in addition to
tar archive. ez_setup.py now uses zip archive. This approach avoids the potential
security vulnerabilities presented by use of tar archives in ez_setup.py.
...
...
setuptools/command/bdist_egg.py
View file @
9f1f9b14
...
...
@@ -46,8 +46,8 @@ def write_stub(resource, pyfile):
]))
f
.
close
()
# stub __init__.py for packages distributed without one
NS_PKG_STUB
=
'__import__("pkg_resources").declare_namespace(__name__)'
class
bdist_egg
(
Command
):
...
...
@@ -198,7 +198,6 @@ class bdist_egg(Command):
to_compile
.
append
(
pyfile
)
ext_outputs
[
p
]
=
ext_name
.
replace
(
os
.
sep
,
'/'
)
to_compile
.
extend
(
self
.
make_init_files
())
if
to_compile
:
cmd
.
byte_compile
(
to_compile
)
if
self
.
distribution
.
data_files
:
...
...
@@ -270,30 +269,7 @@ class bdist_egg(Command):
log
.
warn
(
"zip_safe flag not set; analyzing archive contents..."
)
return
analyze_egg
(
self
.
bdist_dir
,
self
.
stubs
)
def
make_init_files
(
self
):
"""Create missing package __init__ files"""
init_files
=
[]
for
base
,
dirs
,
files
in
walk_egg
(
self
.
bdist_dir
):
if
base
==
self
.
bdist_dir
:
# don't put an __init__ in the root
continue
for
name
in
files
:
if
name
.
endswith
(
'.py'
):
if
'__init__.py'
not
in
files
:
pkg
=
base
[
len
(
self
.
bdist_dir
)
+
1
:].
replace
(
os
.
sep
,
'.'
)
if
self
.
distribution
.
has_contents_for
(
pkg
):
log
.
warn
(
"Creating missing __init__.py for %s"
,
pkg
)
filename
=
os
.
path
.
join
(
base
,
'__init__.py'
)
if
not
self
.
dry_run
:
f
=
open
(
filename
,
'w'
);
f
.
write
(
NS_PKG_STUB
)
f
.
close
()
init_files
.
append
(
filename
)
break
else
:
# not a package, don't traverse to subdirectories
dirs
[:]
=
[]
return
init_files
def
gen_header
(
self
):
epm
=
EntryPoint
.
parse_map
(
self
.
distribution
.
entry_points
or
''
)
...
...
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