krupan / albion

A UNIX/Linux environment manager that allows on-the-fly configuration of your shell environment. Scroll down to read more.
GNU General Public License v3.0
2 stars 1 forks source link

Port createmodule.py to albion? #3

Open cmarqu opened 7 years ago

cmarqu commented 7 years ago

If you are looking for ideas to make adoption of albion easier, one would be to port the createmodule.py script from Environment Modules over. See https://lists.fedoraproject.org/pipermail/scm-commits/2012-October/893142.html

For my use case however, this alone would not help, since setting a project up here does not just involve a single script, but some interactive menu structure thing. I thought of two invocations of createmodule.py, one before entering the project, one after, where createmodule.py would use Python's pickle to save/restore the old state to/from a file. But AFAIK, pickle is not guaranteed to be compatible between different Python versions, so maybe that's not the best option if entering a project changes the default Python version...

Having such a script would even make switching from modules to albion easy - just use createalbion.py "module load foo/1.23".

krupan commented 7 years ago

So sorry I'm so late to respond to this. One of the big benefits of albion over Modules is that you don't have to convert your shell init files over to tcl or any other language, albion just sources your shell script directly.

Oh, I guess you are saying that if someone is already using Modules they could use a script to convert from Modules' tcl syntax back over to shell syntax...yeah, I suppose that would be useful for people that no longer have the shell script that Xilinx or whoever gave them that they had to convert to tcl, or if they actually wrote modulefiles by hand.

I don't fully understand your interactive menu workflow with two invocations of createmodule.py. Not sure if that's still a concern almost a year later. Let me know if it is.

cmarqu commented 7 years ago

Yes, I'm imagining case where someone is using some project setup system (Modules most often) and wants to introduce Albion gradually, project by project, needing to support both systems in parallel for some time.

My setup here is some self-written thing (not invented by myself, and not using Modules or anything like that). It interactively asks you for project name, project version, and potentially other things. There is no way to let it run in "batch mode", and thus there is no way to run createmodule.py that doesn't require user input - it would just hang at where it expects me to input something. So the idea was to record the environment in a fresh shell (env > before.txt), then I would enter the project interactively, and record the environment again (env > after.txt). The diff of these two files would be what is needed in a module file or albionrc.

Actually... some things are still missing then, for instance: copied/removed/modified files, declared aliases. Anything else?