Skip to content

Commit

Permalink
Prefer import to __import__
Browse files Browse the repository at this point in the history
  • Loading branch information
zwimer committed Nov 23, 2022
1 parent 3415e08 commit c3ab5d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist/
*.so
.noseids
*.sublime-workspace
*.egg-info
15 changes: 6 additions & 9 deletions gitdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@

def _init_externals():
"""Initialize external projects by putting them into the path"""
for module in ('smmap',):
if 'PYOXIDIZER' not in os.environ:
sys.path.append(os.path.join(os.path.dirname(__file__), 'ext', module))

try:
__import__(module)
except ImportError as e:
raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) from e
# END verify import
if 'PYOXIDIZER' not in os.environ:
where = os.path.join(os.path.dirname(__file__), 'ext', 'smmap')
if os.path.exists(where):
sys.path.append(where)

import smmap
# END handle imports

#} END initialization
Expand Down

0 comments on commit c3ab5d7

Please sign in to comment.