Skip to content

Commit

Permalink
clamnewproject fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Nov 2, 2018
1 parent 588f1c1 commit 6cae46c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions clam/clamnewproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ def main():


if not os.path.exists(os.path.join(sourcedir, "__init__.py")):
f = open(os.path.join(sourcedir, "/__init__.py"),'w')
f = open(os.path.join(sourcedir, "__init__.py"),'w')
f.close()

if not os.path.exists(os.path.join(sourcedir, args.sysid + '.py')):
fin = io.open(os.path.join(CLAMDIR, '/config/template.py'),'r',encoding='utf-8')
fin = io.open(os.path.join(CLAMDIR, 'config/template.py'),'r',encoding='utf-8')
fout = io.open(os.path.join(sourcedir, args.sysid + '.py'),'w',encoding='utf-8')
for line in fin:
if line == "SYSTEM_ID = \"\"\n":
Expand All @@ -128,7 +128,7 @@ def main():
sys.exit(2)

if not os.path.exists(os.path.join(rootdir, 'setup_template.py')):
fin = io.open(os.path.join(CLAMDIR, '/config/setup_template.py'),'r',encoding='utf-8')
fin = io.open(os.path.join(CLAMDIR, 'config/setup_template.py'),'r',encoding='utf-8')
fout = io.open(os.path.join(rootdir, 'setup.py'),'w',encoding='utf-8')
for line in fin:
line = line.replace("SYSTEM_ID", args.sysid)
Expand Down Expand Up @@ -239,7 +239,7 @@ def main():
threads = 2
#enable this for nginx:
#manage-script-name = yes
""").format(sourcedir=sourcedir, rootdir=rootdir,sysid=args.sysid, uwsgiplugin=uwsgiplugin,pythonversion=args.pythonversion, uwsgiport=args.uwsgiport, virtual_env=os.environ['VIRTUAL_ENV'])
""".format(sourcedir=sourcedir, rootdir=rootdir,sysid=args.sysid, uwsgiplugin=uwsgiplugin,pythonversion=args.pythonversion, uwsgiport=args.uwsgiport, virtual_env=os.environ['VIRTUAL_ENV']))
if virtualenv:
with io.open(os.path.join(rootdir,args.sysid + '.ini'),'a',encoding='utf-8') as f:
f.write("virtualenv = " + virtualenv + "\n")
Expand Down Expand Up @@ -319,7 +319,7 @@ def main():
git init
git add *
git commit -m "generated by clamnewproject"
""".format(dir=dir,sysid=args.sysid)
""".format(rootdir=rootdir,sysid=args.sysid)

print( s2,file=sys.stderr)

Expand All @@ -333,12 +333,16 @@ def main():
else:
pip = 'pip'

with io.open(dir + "/INSTALL",'w',encoding='utf-8') as f:
with io.open(os.path.join(rootdir,"INSTALL"),'w',encoding='utf-8') as f:
f.write("""Install CLAM from the Python package index with:
$ {pip} install clam
You may need to use sudo for global installation. We recommend the use of Python virtual environment.
Install the webservice:
$ python setup.py install
You may need to use sudo for global installation. We recommend the use of a Python virtual environment.
The webservice runs from this directory directly. No further installation is necessary.""".format(pip=pip))

Expand Down

0 comments on commit 6cae46c

Please sign in to comment.