コード例 #1
0
ファイル: python.py プロジェクト: Gear61/cs118
def install_pyfile(self,node,install_from=None):
	from_node=install_from or node.parent
	tsk=self.bld.install_as(self.install_path+'/'+node.path_from(from_node),node,postpone=False)
	path=tsk.get_install_path()
	if self.bld.is_install<0:
		info("+ removing byte compiled python files")
		for x in'co':
			try:
				os.remove(path+x)
			except OSError:
				pass
	if self.bld.is_install>0:
		try:
			st1=os.stat(path)
		except:
			error('The python file is missing, this should not happen')
		for x in['c','o']:
			do_inst=self.env['PY'+x.upper()]
			try:
				st2=os.stat(path+x)
			except OSError:
				pass
			else:
				if st1.st_mtime<=st2.st_mtime:
					do_inst=False
			if do_inst:
				lst=(x=='o')and[self.env['PYFLAGS_OPT']]or[]
				(a,b,c)=(path,path+x,tsk.get_install_path(destdir=False)+x)
				argv=self.env['PYTHON']+lst+['-c',INST,a,b,c]
				info('+ byte compiling %r'%(path+x))
				env=self.env.env or None
				ret=Utils.subprocess.Popen(argv,env=env).wait()
				if ret:
					raise Errors.WafError('py%s compilation failed %r'%(x,path))
コード例 #2
0
def do_install_dir(self, tgt, **kw):
    """
    Create a directory tgt and all its parents. The actual creating or mode
    modification is not performed if the directory already exists with the
    given permissions

    This method is overridden in :py:meth:`waflib.Build.UninstallContext.do_install_dir` to remove the file.

    :param tgt: directory name, as absolute path
    :type tgt: string
    :param chmod: installation mode
    :type chmod: int
    """
    mode = kw.get('chmod', O755)

    # Do not install when already present with correct mode.
    try:
        if stat(tgt).st_mode & 0o777 == mode & 0o777:
            if not self.progress_bar:
                info('- install %s (directory)' % (tgt, ))
            return False
    except OSError:
        pass

    check_dir(tgt)
    chmod(tgt, mode)
    if not self.progress_bar:
        info('+ install %s (directory) %s' % (tgt, mode))
コード例 #3
0
ファイル: _pytest.py プロジェクト: depixusgenome/wafbuilder
    def test(cls, bld):
        "do unit tests"
        from waflib.Logs import info
        info("Using CONDA_DEFAULT_ENV: %s",
             os.environ.get('CONDA_DEFAULT_ENV', '-'))
        info("Path to os module: %s", os.__file__)
        os.chdir(cls.__outdir(bld))
        opt = bld.options
        if opt.TEST_HEADLESS:
            os.environ['DPX_TEST_HEADLESS'] = 'True'

        junit = () if not opt.JUNIT_XML else ('--junit-xml', opt.JUNIT_XML)
        cmd = ["tests", *opt.TEST_GROUP, *junit, *cls.OPTS]
        if opt.PYTEST_V:
            cmd.append("-v")
        if opt.PYTEST_ARGS:
            args = opt.PYTEST_ARGS[1 if opt.PYTEST_ARGS[0] in
                                   '"\'' else 0:-1 if opt.PYTEST_ARGS[-1] in
                                   '"\'' else None]
            cmd.extend(args.split())

        if not opt.TEST_COV:
            import_module(cls.TEST).cmdline.main(cmd)
            return

        for i in Path(".").glob("./**/*.gcda"):
            i.unlink()

        import_module(cls.COV).main(["run", *cls.OMITS, "-m", cls.TEST, *cmd])
コード例 #4
0
def install_pyfile(self, node):
    tsk = self.bld.install_files(self.install_path, [node], postpone=False)
    path = os.path.join(tsk.get_install_path(), node.name)
    if self.bld.is_install < 0:
        info("+ removing byte compiled python files")
        for x in 'co':
            try:
                os.remove(path + x)
            except OSError:
                pass
    if self.bld.is_install > 0:
        if self.env['PYC'] or self.env['PYO']:
            info("+ byte compiling %r" % path)
        if self.env['PYC']:
            argv = self.env['PYTHON'] + ['-c', INST % 'c', path]
            ret = Utils.subprocess.Popen(argv).wait()
            if ret:
                raise Errors.WafError('pyc compilation failed %r' % path)
        if self.env['PYO']:
            argv = self.env['PYTHON'] + [
                self.env['PYFLAGS_OPT'], '-c', INST % 'o', path
            ]
            ret = Utils.subprocess.Popen(argv).wait()
            if ret:
                raise Errors.WafError('pyo compilation failed %r' % path)
コード例 #5
0
ファイル: python.py プロジェクト: RunarFreyr/waz
def install_pyfile(self, node):
	tsk = self.bld.install_files(self.install_path, [node], postpone=False)
	path = os.path.join(tsk.get_install_path(), node.name)

	if self.bld.is_install < 0:
		info("+ removing byte compiled python files")
		for x in 'co':
			try:
				os.remove(path + x)
			except OSError:
				pass

	if self.bld.is_install > 0:
		if self.env['PYC'] or self.env['PYO']:
			info("+ byte compiling %r" % path)

		if self.env['PYC']:
			argv = [self.env['PYTHON'], '-c', INST % 'c', path]
			ret = Utils.subprocess.Popen(argv).wait()
			if ret:
				raise Errors.WafError('pyc compilation failed %r' % path)

		if self.env['PYO']:
			argv = [self.env['PYTHON'], self.env['PYFLAGS_OPT'], '-c', INST % 'o', path]
			ret = Utils.subprocess.Popen(argv).wait()
			if ret:
				raise Errors.WafError('pyo compilation failed %r' % path)
コード例 #6
0
ファイル: python.py プロジェクト: ita1024/node
def install_pyfile(self, node):
    """
	Execute the installation of a python file

	:param node: python file
	:type node: :py:class:`waflib.Node.Node`
	"""
    tsk = self.bld.install_files(self.install_path, [node], postpone=False)
    path = os.path.join(tsk.get_install_path(), node.name)

    if self.bld.is_install < 0:
        info("+ removing byte compiled python files")
        for x in "co":
            try:
                os.remove(path + x)
            except OSError:
                pass

    if self.bld.is_install > 0:
        if self.env["PYC"] or self.env["PYO"]:
            info("+ byte compiling %r" % path)

        if self.env["PYC"]:
            argv = [self.env["PYTHON"], "-c", INST % "c", path]
            ret = Utils.subprocess.Popen(argv).wait()
            if ret:
                raise Errors.WafError("pyc compilation failed %r" % path)

        if self.env["PYO"]:
            argv = [self.env["PYTHON"], self.env["PYFLAGS_OPT"], "-c", INST % "o", path]
            ret = Utils.subprocess.Popen(argv).wait()
            if ret:
                raise Errors.WafError("pyo compilation failed %r" % path)
コード例 #7
0
ファイル: python.py プロジェクト: janbre/NUTS
def install_pyfile(self, node, install_from=None):
    from_node = install_from or node.parent
    tsk = self.bld.install_as(self.install_path + "/" + node.path_from(from_node), node, postpone=False)
    path = tsk.get_install_path()
    if self.bld.is_install < 0:
        info("+ removing byte compiled python files")
        for x in "co":
            try:
                os.remove(path + x)
            except OSError:
                pass
    if self.bld.is_install > 0:
        try:
            st1 = os.stat(path)
        except:
            error("The python file is missing, this should not happen")
        for x in ["c", "o"]:
            do_inst = self.env["PY" + x.upper()]
            try:
                st2 = os.stat(path + x)
            except OSError:
                pass
            else:
                if st1.st_mtime <= st2.st_mtime:
                    do_inst = False
            if do_inst:
                lst = (x == "o") and [self.env["PYFLAGS_OPT"]] or []
                (a, b, c) = (path, path + x, tsk.get_install_path(destdir=False) + x)
                argv = self.env["PYTHON"] + lst + ["-c", INST, a, b, c]
                info("+ byte compiling %r" % (path + x))
                ret = Utils.subprocess.Popen(argv).wait()
                if ret:
                    raise Errors.WafError("py%s compilation failed %r" % (x, path))
コード例 #8
0
ファイル: msvc.py プロジェクト: GrahamDennis/xpdeint
def print_all_msvc_detected(conf):
	"""
	Print the contents of *conf.env.MSVC_INSTALLED_VERSIONS*
	"""
	for version,targets in conf.env['MSVC_INSTALLED_VERSIONS']:
		info(version)
		for target,l in targets:
			info("\t"+target)
コード例 #9
0
def print_all_msvc_detected(conf):
    """
	Print the contents of *conf.env.MSVC_INSTALLED_VERSIONS*
	"""
    for version, targets in conf.env['MSVC_INSTALLED_VERSIONS']:
        info(version)
        for target, l in targets:
            info("\t" + target)
コード例 #10
0
ファイル: _pytest.py プロジェクト: depixusgenome/wafbuilder
 def html(cls, bld):
     "create the html"
     from waflib.Logs import info
     os.chdir(cls.__outdir(bld))
     opt = bld.options
     gcda = any(Path(".").glob("./**/*.gcda"))
     info("Found gcda files at %s: %s", Path(".").resolve(), gcda)
     Path(opt.TEST_COV).mkdir(parents=True, exist_ok=True)
     out = opt.TEST_COV + ('/Python' if gcda else '')
     import_module(cls.COV).main(["html", "-i", *cls.OMITS, "-d", out])
     if gcda:
         cls.__lcov(bld)
コード例 #11
0
def print_all_msvc_detected(conf):
	for version,targets in conf.env['MSVC_INSTALLED_VERSIONS']:
		info(version)
		for target,l in targets:
			info("\t"+target)
コード例 #12
0
def do_install_dir(self, tgt, **kw):
    if not self.progress_bar:
        info('- remove %s' % tgt)
    self.rm_empty_dirs(join(tgt, '.empty'))