-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from jngrad/venv
Configure the pyMBE virtual environment
- Loading branch information
Showing
17 changed files
with
183 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import argparse | ||
import sysconfig | ||
try: | ||
import espressomd | ||
espressomd_found = True | ||
except ModuleNotFoundError: | ||
espressomd_found = False | ||
|
||
|
||
def make_pth(name, path): | ||
if not os.path.isdir(path): | ||
raise ValueError(f"Folder '{path}' doesn't exist") | ||
site_packages = sysconfig.get_path("platlib") | ||
with open(os.path.join(site_packages, f"{name}.pth"), "w") as f: | ||
f.write(os.path.realpath(path)) | ||
|
||
|
||
parser = argparse.ArgumentParser(description="Configure pyBME and ESPResSo module paths") | ||
parser.add_argument("--espresso_path", type=str, required=not espressomd_found, | ||
help="Path to the ESPResSo build folder") | ||
args = parser.parse_args() | ||
|
||
if not os.environ.get("VIRTUAL_ENV"): | ||
raise RuntimeError("This script should be run in a virtual environment") | ||
|
||
if not espressomd_found: | ||
make_pth("espresso", os.path.join(args.espresso_path, "src", "python")) | ||
make_pth("pymbe", os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.