diff --git a/cms/conf.py b/cms/conf.py index 96e53ab836..83f4794952 100644 --- a/cms/conf.py +++ b/cms/conf.py @@ -162,37 +162,14 @@ def __init__(self): self.max_jobs_per_user = 10 self.pdf_printing_allowed = False - # Installed or from source? - # We declare we are running from installed if the program was - # NOT invoked through some python flavor, and the file is in - # the prefix (or real_prefix to accommodate virtualenvs). - bin_path = os.path.join(os.getcwd(), sys.argv[0]) - bin_name = os.path.basename(bin_path) - bin_is_python = bin_name in ["ipython", "python", "python3"] - bin_in_installed_path = bin_path.startswith(sys.prefix) or ( - hasattr(sys, 'real_prefix') - and bin_path.startswith(sys.real_prefix)) - self.installed = bin_in_installed_path and not bin_is_python - - if self.installed: - self.log_dir = os.path.join("/", "var", "local", "log", "cms") - self.cache_dir = os.path.join("/", "var", "local", "cache", "cms") - self.data_dir = os.path.join("/", "var", "local", "lib", "cms") - self.run_dir = os.path.join("/", "var", "local", "run", "cms") - paths = [os.path.join("/", "usr", "local", "etc", "cms.conf"), - os.path.join("/", "etc", "cms.conf")] - else: - self.log_dir = "log" - self.cache_dir = "cache" - self.data_dir = "lib" - self.run_dir = "run" - paths = [os.path.join(".", "config", "cms.conf")] - if '__file__' in globals(): - paths += [os.path.abspath(os.path.join( - os.path.dirname(__file__), - '..', 'config', 'cms.conf'))] - paths += [os.path.join("/", "usr", "local", "etc", "cms.conf"), - os.path.join("/", "etc", "cms.conf")] + self.log_dir = os.path.join("/", "var", "local", "log", "cms") + self.cache_dir = os.path.join("/", "var", "local", "cache", "cms") + self.data_dir = os.path.join("/", "var", "local", "lib", "cms") + self.run_dir = os.path.join("/", "var", "local", "run", "cms") + paths = [ + os.path.join("/", "usr", "local", "etc", "cms.conf"), + os.path.join("/", "etc", "cms.conf"), + ] # Allow user to override config file path using environment # variable 'CMS_CONFIG'. diff --git a/cms/service/ResourceService.py b/cms/service/ResourceService.py index 47a981f47f..463658a839 100644 --- a/cms/service/ResourceService.py +++ b/cms/service/ResourceService.py @@ -247,11 +247,6 @@ def _restart_services(self): logger.info("Restarting (%s, %s)...", service.name, service.shard) command = os.path.join(BIN_PATH, "cms%s" % service.name) - if not config.installed: - command = os.path.join( - ".", - "scripts", - "cms%s" % service.name) args = [command, "%d" % service.shard] if self.contest_id is not None: args += ["-c", str(self.contest_id)] diff --git a/cmscontrib/loaders/polygon.py b/cmscontrib/loaders/polygon.py index 200dd38c8d..0a16d95faa 100644 --- a/cmscontrib/loaders/polygon.py +++ b/cmscontrib/loaders/polygon.py @@ -185,9 +185,6 @@ def get_task(self, get_statement=True): os.path.dirname(checker_src), "checker") testlib_path = "/usr/local/include/cms" testlib_include = os.path.join(testlib_path, "testlib.h") - if not config.installed: - testlib_path = os.path.join(os.path.dirname(__file__), - "polygon") code = subprocess.call(["g++", "-x", "c++", "-O2", "-static", "-DCMS", "-I", testlib_path, "-include", testlib_include, diff --git a/cmsranking/Config.py b/cmsranking/Config.py index da0511aa33..b302c09453 100644 --- a/cmsranking/Config.py +++ b/cmsranking/Config.py @@ -57,32 +57,13 @@ def __init__(self): # Buffers self.buffer_size = 100 # Needs to be strictly positive. - # File system. - # TODO: move to cmscommon as it is used both here and in cms/conf.py - bin_path = os.path.join(os.getcwd(), sys.argv[0]) - bin_name = os.path.basename(bin_path) - bin_is_python = bin_name in ["ipython", "python", "python3"] - bin_in_installed_path = bin_path.startswith(sys.prefix) or ( - hasattr(sys, 'real_prefix') - and bin_path.startswith(sys.real_prefix)) - self.installed = bin_in_installed_path and not bin_is_python - self.web_dir = pkg_resources.resource_filename("cmsranking", "static") - if self.installed: - self.log_dir = os.path.join("/", "var", "local", "log", - "cms", "ranking") - self.lib_dir = os.path.join("/", "var", "local", "lib", - "cms", "ranking") - self.conf_paths = [os.path.join("/", "usr", "local", "etc", - "cms.ranking.conf"), - os.path.join("/", "etc", "cms.ranking.conf")] - else: - self.log_dir = os.path.join("log", "ranking") - self.lib_dir = os.path.join("lib", "ranking") - self.conf_paths = [os.path.join(".", "config", "cms.ranking.conf"), - os.path.join("/", "usr", "local", "etc", - "cms.ranking.conf"), - os.path.join("/", "etc", "cms.ranking.conf")] + self.log_dir = os.path.join("/", "var", "local", "log", "cms", "ranking") + self.lib_dir = os.path.join("/", "var", "local", "lib", "cms", "ranking") + self.conf_paths = [ + os.path.join("/", "usr", "local", "etc", "cms.ranking.conf"), + os.path.join("/", "etc", "cms.ranking.conf"), + ] # Allow users to override config file path using environment # variable 'CMS_RANKING_CONFIG'.