Skip to content

Commit

Permalink
make pythia8 install write-protected
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangWaltenberger committed Jan 19, 2024
1 parent 1140b81 commit 78ebf2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions smodels/lib/pythia8/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ install_pythia8:
./installer.py

clean:
chmod -R u+w pythia$(PYTHIAVER)
rm -rf $(EXES) test.slha pythia$(PYTHIAVER) .pythia*.tgz* pythia*.tgz* pythia8.exe events.lhe

pythia8.exe: pythia8.cc .PHONY
Expand Down
12 changes: 11 additions & 1 deletion smodels/lib/pythia8/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def checkPythiaHeaderFile():
return True

def compilePythia():
""" finally, compile pythia """
""" compile pythia """
ver = getVersion()
ncpus = max ( 1, getNCPUs()-2 )
cmd = f"cd pythia{ver}; ./configure ; make -j {ncpus}"
Expand All @@ -145,6 +145,15 @@ def compilePythia():
sys.stdout.buffer.write(c)
sys.stdout.buffer.flush()

def fixACLs():
""" finally, remove all writable flags from install. when running
many pythia8 instances in parallel, for some reason they sometimes deleted
files from the install, making the install unusable """
# print ( f"fixACLs: {os.getcwd()}" )
cmd = "chmod -R a-w pythia8308"
import subprocess
subprocess.getoutput ( cmd )

def installPythia():
""" fetch tarball, unzip it, compile pythia """
if checkPythia() and checkPythiaHeaderFile():
Expand All @@ -156,6 +165,7 @@ def installPythia():
fetch()
unzip()
compilePythia()
fixACLs()
rmTarball()

if __name__ == "__main__":
Expand Down

0 comments on commit 78ebf2a

Please sign in to comment.