Skip to content

Commit

Permalink
added install_python_requirements to the CM repo description (cmr.y…
Browse files Browse the repository at this point in the history
…aml)

to install requirements to a current python with CM installation if needed
  • Loading branch information
gfursin committed Oct 2, 2024
1 parent 2b7fe5d commit 0c026ba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cm/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## V2.3.9.1
- added `install_python_requirements` to the CM repo description (cmr.yaml)
to install requirements to a current python with CM installation if needed

## V2.3.9
- added `--min` == `--skip` to `cm init` for readability
- added `--checkout` to `cm init` to handle checkout
Expand Down
2 changes: 1 addition & 1 deletion cm/cmind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Written by Grigori Fursin

__version__ = "2.3.9"
__version__ = "2.3.9.1"

from cmind.core import access
from cmind.core import error
Expand Down
20 changes: 20 additions & 0 deletions cm/cmind/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,26 @@ def pull(self, alias, url = '', branch = '', checkout = '', console = False, des

warnings = r.get('warnings', [])

# Check if need to install requirements
install_python_requirements = meta.get('install_python_requirements', False)

if install_python_requirements:
import sys

python_exec = sys.executable

cmd = python_exec + ' -m pip install -r requirements.txt'

if console:
print ('')
print (cmd)
print ('')

r = os.system(cmd)

if r>0:
return {'return':1, 'error':'pip install -r requirements failed for this CM repository'}

# Go back to original directory
os.chdir(cur_dir)

Expand Down

0 comments on commit 0c026ba

Please sign in to comment.