You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
582 B
Python
19 lines
582 B
Python
import os, subprocess, getpass
|
|
|
|
# Feel free to edit this file, but note that `make deploy` expects the service file to be output as `new.service`
|
|
# It, of course, is renamed to `localizer.service` as it's moved to `/etc/systemd/system/`
|
|
|
|
text = open("new.service").read()
|
|
text = text.replace(
|
|
"GCPATH",
|
|
subprocess.check_output(["/usr/bin/bash", "-c", "which gunicorn"])
|
|
.decode("utf-8")
|
|
.strip(),
|
|
)
|
|
text = text.replace("PATH", os.getcwd())
|
|
text = text.replace("WHO", getpass.getuser())
|
|
|
|
os.remove("new.service")
|
|
with open("new.service", "w") as f:
|
|
f.write(text)
|