-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make main.py
executable and create a symlink during installation
#21
Conversation
Rather import stuff via absolute paths
ef380c6
to
b2a5c57
Compare
Make sure that main.py doesn't have to be changed by exposing the Generators.Generators class via __init__.py
Add protection against no -f argument
Protection added against -f FILENAME absent on command line |
Is not passing an input yaml file a "user error"? I.e. is the expectation that there should always be at least one yaml file? Because then we can just change |
|
||
install(CODE "execute_process(COMMAND bash -c \"set -e | ||
link_target=${CMAKE_INSTALL_PREFIX}/python/main.py | ||
link_name=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/k4GeneratorsConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link_name=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/k4GeneratorsConfig | |
link_name=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/k4generatorsConfig |
I just realized that the alias
in setup.sh
is capitalized this way. I have no preference either way, it just has to be consistent in the end. @dirkzerwas any preferences from your side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your choice makes more sense, let's leave it as "k4GeneratorsConfig" , I will update the setups and tests to be consistent.
BEGINRELEASENOTES
main.py
as executable and create a symlink from<prefix>/bin/k4GeneratorsConfig
to<prefix>/python/main.py
during installation. This makes it possible to setup an environment wherek4GeneratorsConfig
can be used as a simple executablePYTHONPATH
modifications from within the interpreter and use absolute imports. This makes it possible to simply add<prefix>/pyhton
to thePYTHONPATH
and everything will work.Generators.Generators
via settings in__init__.py
ENDRELEASENOTES
One thing I discovered that simply calling
<prefix>/bin/k4GeneratorsConfig
without argument, leads to:Ideally this should simply spit out a usage message, rather than error. Things work with
-h
or--help
. Maybe there is an easy way to fix this, by e.g. making some of the arguments required, in which caseargparse
would do the right thing.k4GeneratorsConfig
symlink? See also dicsussion in Add k4GeneratorsConfig package and include it in key4hep-stack key4hep-spack#617