Skip to content

Commit

Permalink
Merge branch 'develop' into MLE-working-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MCFlowMace committed Sep 21, 2023
2 parents 9ff5623 + 7edae57 commit 14d55f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DESKTOP_PARALLEL_JOBS = 2
PYTHON_SCRIPT_DIR = /some/directory
```

As last step, run `pip install .` in the directory with setup.py.
**IMPORTANT**: As last step, run `python setup.py clean --all; pip install . ; python setup.py clean --all` in the directory with setup.py. This combined command is the safest way for installation in all situations. For further explanation: in theory `pip install .` is sufficient for a first installation after initially cloning the repo. **But** newer versions of pip create a `build` directory inside the repository and do not clean it up automatically after the installation. During development or when pulling new versions this directory can cause issues if it is not cleaned up after the installation. Therefore it is advised to adapt this installation routine in order to make sure no old build artifacts can mess with the installation process.

Note: If you are using the system wide python environment (not recommended) instead of a virtual environment (e.g. with Anaconda) the package data will go to `/usr/local`, which causes access permission issues with Docker. As a workaround use `pip install -e .` which creates symlinks to the repo instead of copying files.

Expand Down
19 changes: 14 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"""

from distutils.cmd import Command

from setuptools import setup
import setuptools
from setuptools.command.build_py import build_py
import versioneer
import subprocess
import glob
from pathlib import Path
import shutil

from hercules import _versionhelper

Expand All @@ -23,9 +24,17 @@ def run(self) -> None:
#pickle CRESana models
try:
import cresana
path = 'hercules/hexbug/Phase4/CRESana_models'
for file in glob.glob(path+'/*.py'):
subprocess.run(['python', file])
path = Path('hercules/hexbug/Phase4/CRESana_models')
paths_to_delete = [p for p in path.glob('*') if not p.suffix=='.py']

for p in paths_to_delete:
if p.is_file():
p.unlink()
else:
shutil.rmtree(p)

for file in path.glob('*.py'):
subprocess.run(['python', str(file)])

except:
print('Not installing CRESana models')
Expand Down

0 comments on commit 14d55f6

Please sign in to comment.