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
17d0ff6e
Commit
17d0ff6e
authored
Jun 22, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract the additional trailing lines when a parent package is indicated.
parent
ab7d8ee3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
setuptools/command/install_egg_info.py
setuptools/command/install_egg_info.py
+13
-10
No files found.
setuptools/command/install_egg_info.py
View file @
17d0ff6e
...
@@ -60,16 +60,21 @@ class install_egg_info(Command):
...
@@ -60,16 +60,21 @@ class install_egg_info(Command):
unpack_archive
(
self
.
source
,
self
.
target
,
skimmer
)
unpack_archive
(
self
.
source
,
self
.
target
,
skimmer
)
_nspkg_tmpl
=
[
_nspkg_tmpl
=
(
"import sys, types, os"
,
"import sys, types, os"
,
"p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r)"
,
"p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r)"
,
"ie = os.path.exists(os.path.join(p,'__init__.py'))"
,
"ie = os.path.exists(os.path.join(p,'__init__.py'))"
,
"m = not ie and sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))"
,
"m = not ie and sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))"
,
"mp = (m or []) and m.__dict__.setdefault('__path__',[])"
,
"mp = (m or []) and m.__dict__.setdefault('__path__',[])"
,
"(p not in mp) and mp.append(p)
%(trailer)s
"
,
"(p not in mp) and mp.append(p)"
,
]
)
"lines for the namespace installer"
"lines for the namespace installer"
_nspkg_tmpl_multi
=
(
'm and setattr(sys.modules[%(parent)r], %(child)r, m)'
,
)
"additional line(s) when a parent package is indicated"
def
install_namespaces
(
self
):
def
install_namespaces
(
self
):
nsp
=
self
.
_get_all_ns_packages
()
nsp
=
self
.
_get_all_ns_packages
()
if
not
nsp
:
if
not
nsp
:
...
@@ -84,13 +89,11 @@ class install_egg_info(Command):
...
@@ -84,13 +89,11 @@ class install_egg_info(Command):
# ensure pkg is not a unicode string under Python 2.7
# ensure pkg is not a unicode string under Python 2.7
pkg
=
str
(
pkg
)
pkg
=
str
(
pkg
)
pth
=
tuple
(
pkg
.
split
(
'.'
))
pth
=
tuple
(
pkg
.
split
(
'.'
))
trailer
=
'
\
n
'
tmpl_lines
=
self
.
_nspkg_tmpl
if
'.'
in
pkg
:
parent
,
sep
,
child
=
pkg
.
rpartition
(
'.'
)
trailer
=
(
if
parent
:
"; m and setattr(sys.modules[%r], %r, m)
\
n
"
tmpl_lines
+=
self
.
_nspkg_tmpl_multi
%
(
'.'
.
join
(
pth
[:
-
1
]),
pth
[
-
1
])
dat
=
';'
.
join
(
tmpl_lines
)
%
locals
()
+
'
\
n
'
)
dat
=
';'
.
join
(
self
.
_nspkg_tmpl
)
%
locals
()
f
.
write
(
dat
)
f
.
write
(
dat
)
f
.
close
()
f
.
close
()
...
...
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