Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: head toward a canonical way to phrase sys.path setup #56

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added mig/ident.py
Empty file.
11 changes: 7 additions & 4 deletions mig/install/generateconfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@
# Solve this by ensuring that the chckout is part of the sys.path

# NOTE: __file__ is /MIG_BASE/mig/install/generateconfs.py and we need MIG_BASE

sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), "../..")))

# NOTE: moved mig imports into try/except to avoid autopep8 moving to top!
try:
import mig.ident
from mig.shared.install import generate_confs
except ImportError:
print("ERROR: the migrid modules must be in PYTHONPATH")
except ImportError as ioe:
if ioe.name == 'mig.ident':
print("ERROR: the migrid modules must be in PYTHONPATH")
else:
print("ERROR: could not import migrid modules - " + str(ioe))
sys.exit(1)


Expand Down
8 changes: 6 additions & 2 deletions mig/shared/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@
listdir = os.listdir

try:
import mig.ident
from mig.shared.base import force_utf8_rec
from mig.shared.defaults import default_chunk_size, default_max_chunks
from mig.shared.logger import null_logger
from mig.shared.pwcrypto import valid_hash_algos, default_algo
from mig.shared.serial import dump, load
except ImportError as ioe:
print("ERROR: could not import migrid modules!")
exit(1)
if ioe.name == 'mig.ident':
print("ERROR: the migrid modules must be in PYTHONPATH")
else:
print("ERROR: could not import migrid modules - " + str(ioe))
sys.exit(1)


def _auto_adjust_mode(data, mode):
Expand Down
Loading