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
3d71f8b9
Commit
3d71f8b9
authored
Oct 23, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow the root to be overridden
parent
3617c2b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
setuptools/namespaces.py
setuptools/namespaces.py
+8
-5
No files found.
setuptools/namespaces.py
View file @
3d71f8b9
...
...
@@ -33,7 +33,7 @@ class Installer:
_nspkg_tmpl
=
(
"import sys, types, os"
,
"pep420 = sys.version_info > (3, 3)"
,
"p = os.path.join(
sys._getframe(1).f_locals['sitedir']
, *%(pth)r)"
,
"p = os.path.join(
%(root)s
, *%(pth)r)"
,
"ie = os.path.exists(os.path.join(p,'__init__.py'))"
,
"m = not ie and not pep420 and "
"sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))"
,
...
...
@@ -47,15 +47,18 @@ class Installer:
)
"additional line(s) when a parent package is indicated"
@
classmethod
def
_gen_nspkg_line
(
cls
,
pkg
):
def
_get_root
(
self
):
return
"sys._getframe(1).f_locals['sitedir']"
def
_gen_nspkg_line
(
self
,
pkg
):
# ensure pkg is not a unicode string under Python 2.7
pkg
=
str
(
pkg
)
pth
=
tuple
(
pkg
.
split
(
'.'
))
tmpl_lines
=
cls
.
_nspkg_tmpl
root
=
self
.
_get_root
()
tmpl_lines
=
self
.
_nspkg_tmpl
parent
,
sep
,
child
=
pkg
.
rpartition
(
'.'
)
if
parent
:
tmpl_lines
+=
cls
.
_nspkg_tmpl_multi
tmpl_lines
+=
self
.
_nspkg_tmpl_multi
return
';'
.
join
(
tmpl_lines
)
%
locals
()
+
'
\
n
'
def
_get_all_ns_packages
(
self
):
...
...
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