def execute(self): os.environ["TEST_USER"] = "******" self.proj = Project(self.input, 'pysysproject.xml') for attr in dir(self.proj): if attr in ['lib', 'library', 'version', 'user']: self.log.info("%s = %s", attr, eval("self.proj.%s" % attr)) stdoutHandler.setFormatter(PROJECT.formatters.stdout)
def loadproject(start): """Load the PySys project file. The method walks up the directory tree from the supplied path until the PySys project file is found. The location of the project file defines the project root location. The contents of the project file determine project specific constants as specified by property elements in the xml project file. To ensure that all loaded modules have a pre-initialised projects instance, any launching application should first import the loadproject file, and then make a call to it prior to importing all names within the constants module. @param start: The initial path to start from when trying to locate the project file """ global PROJECT projectFile = os.getenv('PYSYS_PROJECTFILE', None) search = start if not projectFile: projectFileSet = set(DEFAULT_PROJECTFILE) drive, path = os.path.splitdrive(search) while (not search == drive): intersection = projectFileSet & set(os.listdir(search)) if intersection: projectFile = intersection.pop() break else: search, drop = os.path.split(search) if not drop: search = drive if not (projectFile is not None and os.path.exists(os.path.join(search, projectFile))): sys.stderr.write( "WARNING: No project file found, taking project root to be '%s' \n" % (search or '.')) try: PROJECT = Project(search, projectFile) stdoutHandler.setFormatter(PROJECT.formatters.stdout) except (ImportError, SyntaxError) as e: sys.stderr.write("ERROR: %s - %s\n" % (e.__class__.__name__, e)) traceback.print_exc() sys.exit(1) except Exception as e: sys.stderr.write("ERROR: %s - %s\n" % (e.__class__.__name__, e)) sys.exit(1)
def execute(self): self.proj = Project(self.input, 'pysysproject.xml') stdoutHandler.setFormatter(self.project.formatters.stdout)
def execute(self): os.environ["TEST_USER"] = "******" self.proj = Project(self.input, 'pysysproject.xml') stdoutHandler.setFormatter(PROJECT.formatters.stdout)