Skip to content

Commit

Permalink
Merge pull request #82 from zwimer/prefer-standard-import
Browse files Browse the repository at this point in the history
Prefer `import` to `__import__`
  • Loading branch information
Byron authored Nov 23, 2022
2 parents 3415e08 + 1edc7d2 commit 43de984
Show file tree
Hide file tree
Showing 2 changed files with 8 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
16 changes: 7 additions & 9 deletions gitdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@

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
del smmap
# END handle imports

#} END initialization
Expand Down

0 comments on commit 43de984

Please sign in to comment.