MolSSI-MDI / MDI_Driver_Cookiecutter

Cookiecutter for creating MDI Drivers
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

MDI CookieCutter project creation fails with some git versions #4

Open janash opened 2 months ago

janash commented 2 months ago

When running the MDI CookieCutter I got the following error.

git: 'subtree' is not a git command. See 'git --help'.
 1
b"git: 'subtree' is not a git command. See 'git --help'.\n"
Traceback (most recent call last):
  File "/tmp/tmp14txghxo.py", line 84, in <module>
    git_init_and_tag()
  File "/tmp/tmp14txghxo.py", line 48, in git_init_and_tag
    invoke_shell("git subtree add --prefix=replica_exchange/mdi https://github.com/MolSSI/MDI_Library master --squash")
  File "/tmp/tmp14txghxo.py", line 31, in invoke_shell
    raise e
  File "/tmp/tmp14txghxo.py", line 26, in invoke_shell
    output = sp.check_output(command, shell=True, stderr=sp.STDOUT)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/janash/miniconda3/envs/mdi-work/lib/python3.11/subprocess.py", line 465, in check_output    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/janash/miniconda3/envs/mdi-work/lib/python3.11/subprocess.py", line 569, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'git subtree add --prefix=replica_exchange/mdi https://github.com/MolSSI/MDI_Library master --squash' returned non-zero exit status 1.
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

This occurs because I am in an environment with git installed from conda, which does not seem to contain the subtree command. This error could be caught to either give the user more detailed feedback, or use an alternative command.

taylor-a-barnes commented 2 months ago

Thanks for pointing this out. One option would be to change from using a subtree approach to one in which CMake automatically downloads the MDI Library as part of the build process. That's what LAMMPS and a few other MDI-supporting codes do.