bin/nicos-*: use NICOS_ROOT instead of relative path to script
+ fix guiconfig handling
This commit is contained in:
+2
-8
@@ -26,14 +26,8 @@
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from os import path, environ, chdir
|
||||
|
||||
root = path.dirname(path.dirname(path.dirname(path.realpath(__file__))))
|
||||
nicos_root = path.join(root, 'nicos')
|
||||
sys.path.insert(0, nicos_root)
|
||||
# above packages:
|
||||
sys.path.insert(1, root)
|
||||
|
||||
from os import environ
|
||||
sys.path.insert(0, environ['NICOS_ROOT'])
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-d', '--daemon', dest='daemon', action='store_true',
|
||||
|
||||
+2
-8
@@ -27,14 +27,8 @@
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from os import path, environ, chdir
|
||||
|
||||
root = path.dirname(path.dirname(path.dirname(path.realpath(__file__))))
|
||||
nicos_root = path.join(root, 'nicos')
|
||||
sys.path.insert(0, nicos_root)
|
||||
# above packages:
|
||||
sys.path.insert(1, root)
|
||||
|
||||
from os import environ
|
||||
sys.path.insert(0, environ['NICOS_ROOT'])
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-d', '--daemon', dest='daemon', action='store_true',
|
||||
|
||||
+3
-9
@@ -26,14 +26,8 @@
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from os import path, environ, chdir
|
||||
|
||||
root = path.dirname(path.dirname(path.dirname(path.realpath(__file__))))
|
||||
nicos_root = path.join(root, 'nicos')
|
||||
sys.path.insert(0, nicos_root)
|
||||
# above packages:
|
||||
sys.path.insert(1, root)
|
||||
|
||||
from os import environ
|
||||
sys.path.insert(0, environ['NICOS_ROOT'])
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-d', '--daemon', dest='daemon', action='store_true',
|
||||
@@ -63,4 +57,4 @@ if opts.instrument:
|
||||
from nicos.services.poller.psession import PollerSession
|
||||
|
||||
PollerSession.run(appname, setupname=opts.setupname, maindevname='Poller',
|
||||
start_args=args, daemon=opts.daemon)
|
||||
start_args=args, daemon=opts.daemon)
|
||||
|
||||
+5
-3
@@ -23,6 +23,7 @@
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from glob import glob
|
||||
from os.path import join, abspath, dirname, basename, expanduser, exists, islink
|
||||
from configparser import ConfigParser
|
||||
@@ -89,6 +90,7 @@ class NicosManager(ServiceManager):
|
||||
def do_create(self, ins, *args):
|
||||
if ins == 'check':
|
||||
ins_list = self.wildcard(None)
|
||||
print(ins_list)
|
||||
else:
|
||||
ins_list = self.wildcard(ins)
|
||||
if ins_list is None:
|
||||
@@ -96,8 +98,8 @@ class NicosManager(ServiceManager):
|
||||
self.get_info()
|
||||
for ins_i in ins_list:
|
||||
env = self.env[ins_i]
|
||||
base = join(env['NICOS_ROOT'], env['NICOS_PACKAGE'], ins_i)
|
||||
nicos_conf = join(base, 'nicos.conf')
|
||||
base = Path(env['NICOS_ROOT']) / env['NICOS_PACKAGE'] / ins_i
|
||||
nicos_conf = base / 'nicos.conf'
|
||||
content = {
|
||||
'nicos': {
|
||||
'setup_subdirs': '["%s", "linse_nicos", "frappy_sinq"]' % ins_i,
|
||||
@@ -126,7 +128,7 @@ class NicosManager(ServiceManager):
|
||||
cp[key] = sdict
|
||||
with open(nicos_conf, 'w') as fd:
|
||||
cp.write(fd)
|
||||
shutil.copyfile(join(base, '..', 'common', 'guiconfig.py'), join(base, 'guiconfig.py'))
|
||||
shutil.copyfile(Path(__file__).parent / 'cfg' / 'guiconfig.py', base / 'guiconfig.py')
|
||||
|
||||
@staticmethod
|
||||
def extra_info(ins):
|
||||
|
||||
Reference in New Issue
Block a user