Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Tryton
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tryton
Tryton
Commits
612dce53
Commit
612dce53
authored
1 year ago
by
Cédric Krier
Browse files
Options
Downloads
Patches
Plain Diff
Use entry point load method to load module
This uses the same method as in find_path since
2306ca8df7ee
. Closes
#12884
parent
96a8b0e7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#75355
passed
1 year ago
Stage: preparation
Stage: check
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
trytond/trytond/modules/__init__.py
+1
-24
1 addition, 24 deletions
trytond/trytond/modules/__init__.py
with
1 addition
and
24 deletions
trytond/trytond/modules/__init__.py
+
1
−
24
View file @
612dce53
...
...
@@ -5,6 +5,5 @@
import
itertools
import
logging
import
os
import
sys
from
collections
import
defaultdict
from
glob
import
iglob
...
...
@@ -9,6 +8,5 @@
from
collections
import
defaultdict
from
glob
import
iglob
from
importlib.machinery
import
SOURCE_SUFFIXES
,
FileFinder
,
SourceFileLoader
from
sql
import
Table
from
sql.functions
import
CurrentTimestamp
...
...
@@ -54,28 +52,7 @@
if
name
not
in
EGG_MODULES
:
raise
ep
=
EGG_MODULES
[
name
]
# Can not use ep.load because modules are declared in an importable
# path and it can not import submodule.
path
=
os
.
path
.
join
(
ep
.
dist
.
location
,
*
ep
.
module_name
.
split
(
'
.
'
)[:
-
1
])
if
not
os
.
path
.
isdir
(
path
):
# Find module in path
for
path
in
sys
.
path
:
path
=
os
.
path
.
join
(
path
,
*
ep
.
module_name
.
split
(
'
.
'
)[:
-
1
])
if
os
.
path
.
isdir
(
os
.
path
.
join
(
path
,
name
)):
break
else
:
# When testing modules from setuptools location is the
# module directory
path
=
os
.
path
.
dirname
(
ep
.
dist
.
location
)
spec
=
FileFinder
(
path
,
(
SourceFileLoader
,
SOURCE_SUFFIXES
)
).
find_spec
(
fullname
)
if
spec
.
loader
:
module
=
spec
.
loader
.
load_module
()
else
:
raise
module
=
ep
.
load
()
return
module
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment