Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f1b5a0e3
Commit
f1b5a0e3
authored
May 18, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a feature to support specifying an additional search directory for
packages. (Mark Hammond) Remove Emacs cruft.
parent
5109ffd6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
Tools/freeze/modulefinder.py
Tools/freeze/modulefinder.py
+17
-4
No files found.
Tools/freeze/modulefinder.py
View file @
f1b5a0e3
...
...
@@ -22,6 +22,19 @@ if sys.platform=="win32":
IMPORT_NAME
=
dis
.
opname
.
index
(
'IMPORT_NAME'
)
IMPORT_FROM
=
dis
.
opname
.
index
(
'IMPORT_FROM'
)
# Modulefinder does a good job at simulating Python's, but it can not
# handle __path__ modifications packages make at runtime. Therefore there
# is a mechanism whereby you can register extra paths in this map for a
# package, and it will be honoured.
# Note this is a mapping is lists of paths.
packagePathMap
=
{}
# A Public interface
def
AddPackagePath
(
packagename
,
path
):
paths
=
packagePathMap
.
get
(
packagename
,
[])
paths
.
append
(
path
)
packagePathMap
[
packagename
]
=
paths
class
Module
:
...
...
@@ -288,6 +301,10 @@ class ModuleFinder:
m
=
self
.
add_module
(
fqname
)
m
.
__file__
=
pathname
m
.
__path__
=
[
pathname
]
# As per comment at top of file, simulate runtime __path__ additions.
m
.
__path__
=
m
.
__path__
+
packagePathMap
.
get
(
fqname
,
[])
fp
,
buf
,
stuff
=
self
.
find_module
(
"__init__"
,
m
.
__path__
)
self
.
load_module
(
fqname
,
fp
,
buf
,
stuff
)
self
.
msgout
(
2
,
"load_package ->"
,
m
)
...
...
@@ -405,7 +422,3 @@ if __name__ == '__main__':
test
()
except
KeyboardInterrupt
:
print
"
\
n
[interrupt]"
# Local Variables:
# indent-tabs-mode: nil
# End:
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