Skip to content

Commit

Permalink
core moved git imports inside Ont and Source
Browse files Browse the repository at this point in the history
The ultimate solution here is to move the Source/Ont core classes into
their own file. However, until then this will allow systems without git
to import other classes.
  • Loading branch information
tgbugs committed Sep 24, 2018
1 parent b6e53f9 commit 5946ff8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyontutils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pathlib import Path
from collections import namedtuple
from inspect import getsourcefile
from git import Repo
from rdflib.extras import infixowl
from joblib import Parallel, delayed
import ontquery
Expand Down Expand Up @@ -672,6 +671,7 @@ class Source(tuple):
artifact = None

def __new__(cls):
from git import Repo
if not hasattr(cls, '_data'):
if hasattr(cls, 'runonce'): # must come first since it can modify how cls.source is defined
cls.runonce()
Expand Down Expand Up @@ -876,6 +876,7 @@ def __init__(self, *args, **kwargs):
if hasattr(self, '_repo') and not self._repo:
commit = 'FAKE-COMMIT'
else:
from git import Repo
repo = Repo(working_dir.as_posix())
commit = next(repo.iter_commits()).hexsha

Expand Down

0 comments on commit 5946ff8

Please sign in to comment.