Python distutils.dep_util.newer() Examples
The following are 30
code examples of distutils.dep_util.newer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
distutils.dep_util
, or try the search function
.
Example #1
Source File: test_dep_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #2
Source File: unixccompiler.py From setuptools with MIT License | 6 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): fixed_args = self._fix_compile_args(None, macros, include_dirs) ignore, macros, include_dirs = fixed_args pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError as msg: raise CompileError(msg)
Example #3
Source File: unixccompiler.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): fixed_args = self._fix_compile_args(None, macros, include_dirs) ignore, macros, include_dirs = fixed_args pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError as msg: raise CompileError(msg)
Example #4
Source File: test_dep_util.py From oss-ftp with MIT License | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #5
Source File: test_dep_util.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #6
Source File: test_dep_util.py From Computable with MIT License | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #7
Source File: unixccompiler.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): fixed_args = self._fix_compile_args(None, macros, include_dirs) ignore, macros, include_dirs = fixed_args pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError as msg: raise CompileError(msg)
Example #8
Source File: test_dep_util.py From datafari with Apache License 2.0 | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #9
Source File: twisted_distutils.py From clonedigger with GNU General Public License v3.0 | 6 votes |
def copy_twisted_plugins (self): """Copy each plugin listed in 'self.twisted_plugins'. """ self.mkpath(self.build_dir) for plugin in self.twisted_plugins: adjust = 0 plugin = convert_path(plugin) outfile = os.path.join(self.build_dir, plugin) if not self.force and not newer(plugin, outfile): self.announce("not copying %s (up-to-date)" % plugin) continue # Always open the file, but ignore failures in dry-run mode -- # that way, we'll get accurate feedback if we can read the # plugin. try: f = open(plugin, "r") except IOError: if not self.dry_run: raise f = None else: f.close() self.copy_file(plugin, outfile)
Example #10
Source File: test_dep_util.py From setuptools with MIT License | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #11
Source File: unixccompiler.py From Imogen with MIT License | 6 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): fixed_args = self._fix_compile_args(None, macros, include_dirs) ignore, macros, include_dirs = fixed_args pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError as msg: raise CompileError(msg)
Example #12
Source File: test_dep_util.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #13
Source File: test_dep_util.py From Imogen with MIT License | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #14
Source File: test_dep_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #15
Source File: pippo_server.py From ironpython2 with Apache License 2.0 | 6 votes |
def BuildTypelib(): from distutils.dep_util import newer this_dir = os.path.dirname(__file__) idl = os.path.abspath(os.path.join(this_dir, "pippo.idl")) tlb=os.path.splitext(idl)[0] + '.tlb' if newer(idl, tlb): print "Compiling %s" % (idl,) rc = os.system ('midl "%s"' % (idl,)) if rc: raise RuntimeError("Compiling MIDL failed!") # Can't work out how to prevent MIDL from generating the stubs. # just nuke them for fname in "dlldata.c pippo_i.c pippo_p.c pippo.h".split(): os.remove(os.path.join(this_dir, fname)) print "Registering %s" % (tlb,) tli=pythoncom.LoadTypeLib(tlb) pythoncom.RegisterTypeLib(tli,tlb)
Example #16
Source File: unixccompiler.py From ironpython3 with Apache License 2.0 | 6 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): fixed_args = self._fix_compile_args(None, macros, include_dirs) ignore, macros, include_dirs = fixed_args pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError as msg: raise CompileError(msg)
Example #17
Source File: test_dep_util.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_newer(self): tmpdir = self.mkdtemp() new_file = os.path.join(tmpdir, 'new') old_file = os.path.abspath(__file__) # Raise DistutilsFileError if 'new_file' does not exist. self.assertRaises(DistutilsFileError, newer, new_file, old_file) # Return true if 'new_file' exists and is more recently modified than # 'old_file', or if 'new_file' exists and 'old_file' doesn't. self.write_file(new_file) self.assertTrue(newer(new_file, 'I_dont_exist')) self.assertTrue(newer(new_file, old_file)) # Return false if both exist and 'old_file' is the same age or younger # than 'new_file'. self.assertFalse(newer(old_file, new_file))
Example #18
Source File: bcppcompiler.py From datafari with Apache License 2.0 | 5 votes |
def preprocess (self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): (_, macros, include_dirs) = \ self._fix_compile_args(None, macros, include_dirs) pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = ['cpp32.exe'] + pp_opts if output_file is not None: pp_args.append('-o' + output_file) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or the # source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError, msg: print msg raise CompileError, msg # preprocess()
Example #19
Source File: test_dep_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_newer_group(self): tmpdir = self.mkdtemp() sources = os.path.join(tmpdir, 'sources') os.mkdir(sources) one = os.path.join(sources, 'one') two = os.path.join(sources, 'two') three = os.path.join(sources, 'three') old_file = os.path.abspath(__file__) # return true if 'old_file' is out-of-date with respect to any file # listed in 'sources'. self.write_file(one) self.write_file(two) self.write_file(three) self.assertTrue(newer_group([one, two, three], old_file)) self.assertFalse(newer_group([one, two, old_file], three)) # missing handling os.remove(one) self.assertRaises(OSError, newer_group, [one, two, old_file], three) self.assertFalse(newer_group([one, two, old_file], three, missing='ignore')) self.assertTrue(newer_group([one, two, old_file], three, missing='newer'))
Example #20
Source File: bcppcompiler.py From setuptools with MIT License | 5 votes |
def preprocess (self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): (_, macros, include_dirs) = \ self._fix_compile_args(None, macros, include_dirs) pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = ['cpp32.exe'] + pp_opts if output_file is not None: pp_args.append('-o' + output_file) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or the # source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError as msg: print(msg) raise CompileError(msg) # preprocess()
Example #21
Source File: test_dep_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_newer_group(self): tmpdir = self.mkdtemp() sources = os.path.join(tmpdir, 'sources') os.mkdir(sources) one = os.path.join(sources, 'one') two = os.path.join(sources, 'two') three = os.path.join(sources, 'three') old_file = os.path.abspath(__file__) # return true if 'old_file' is out-of-date with respect to any file # listed in 'sources'. self.write_file(one) self.write_file(two) self.write_file(three) self.assertTrue(newer_group([one, two, three], old_file)) self.assertFalse(newer_group([one, two, old_file], three)) # missing handling os.remove(one) self.assertRaises(OSError, newer_group, [one, two, old_file], three) self.assertFalse(newer_group([one, two, old_file], three, missing='ignore')) self.assertTrue(newer_group([one, two, old_file], three, missing='newer'))
Example #22
Source File: unixccompiler.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): ignore, macros, include_dirs = \ self._fix_compile_args(None, macros, include_dirs) pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError, msg: raise CompileError, msg
Example #23
Source File: unixccompiler.py From RevitBatchProcessor with GNU General Public License v3.0 | 5 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): ignore, macros, include_dirs = \ self._fix_compile_args(None, macros, include_dirs) pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError, msg: raise CompileError, msg
Example #24
Source File: test_dep_util.py From datafari with Apache License 2.0 | 5 votes |
def test_newer_group(self): tmpdir = self.mkdtemp() sources = os.path.join(tmpdir, 'sources') os.mkdir(sources) one = os.path.join(sources, 'one') two = os.path.join(sources, 'two') three = os.path.join(sources, 'three') old_file = os.path.abspath(__file__) # return true if 'old_file' is out-of-date with respect to any file # listed in 'sources'. self.write_file(one) self.write_file(two) self.write_file(three) self.assertTrue(newer_group([one, two, three], old_file)) self.assertFalse(newer_group([one, two, old_file], three)) # missing handling os.remove(one) self.assertRaises(OSError, newer_group, [one, two, old_file], three) self.assertFalse(newer_group([one, two, old_file], three, missing='ignore')) self.assertTrue(newer_group([one, two, old_file], three, missing='newer'))
Example #25
Source File: bcppcompiler.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def preprocess (self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): (_, macros, include_dirs) = \ self._fix_compile_args(None, macros, include_dirs) pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = ['cpp32.exe'] + pp_opts if output_file is not None: pp_args.append('-o' + output_file) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or the # source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError, msg: print msg raise CompileError, msg # preprocess()
Example #26
Source File: unixccompiler.py From datafari with Apache License 2.0 | 5 votes |
def preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): ignore, macros, include_dirs = \ self._fix_compile_args(None, macros, include_dirs) pp_opts = gen_preprocess_options(macros, include_dirs) pp_args = self.preprocessor + pp_opts if output_file: pp_args.extend(['-o', output_file]) if extra_preargs: pp_args[:0] = extra_preargs if extra_postargs: pp_args.extend(extra_postargs) pp_args.append(source) # We need to preprocess: either we're being forced to, or we're # generating output to stdout, or there's a target output file and # the source file is newer than the target (or the target doesn't # exist). if self.force or output_file is None or newer(source, output_file): if output_file: self.mkpath(os.path.dirname(output_file)) try: self.spawn(pp_args) except DistutilsExecError, msg: raise CompileError, msg
Example #27
Source File: build_src.py From ImageFusion with MIT License | 5 votes |
def generate_a_pyrex_source(self, base, ext_name, source, extension): if self.inplace or not have_pyrex(): target_dir = os.path.dirname(base) else: target_dir = appendpath(self.build_src, os.path.dirname(base)) target_file = os.path.join(target_dir, ext_name + '.c') depends = [source] + extension.depends if self.force or newer_group(depends, target_file, 'newer'): if have_pyrex(): import Pyrex.Compiler.Main log.info("pyrexc:> %s" % (target_file)) self.mkpath(target_dir) options = Pyrex.Compiler.Main.CompilationOptions( defaults=Pyrex.Compiler.Main.default_options, include_path=extension.include_dirs, output_file=target_file) pyrex_result = Pyrex.Compiler.Main.compile(source, options=options) if pyrex_result.num_errors != 0: raise DistutilsError("%d errors while compiling %r with Pyrex" \ % (pyrex_result.num_errors, source)) elif os.path.isfile(target_file): log.warn("Pyrex required for compiling %r but not available,"\ " using old target %r"\ % (source, target_file)) else: raise DistutilsError("Pyrex required for compiling %r"\ " but notavailable" % (source,)) return target_file
Example #28
Source File: setup.py From ImageFusion with MIT License | 5 votes |
def source_func(ext, build_dir): import os from distutils.dep_util import newer target = os.path.join(build_dir, 'fib3.f') if newer(__file__, target): f = open(target, 'w') f.write(fib3_f) f.close() return [target]
Example #29
Source File: setup.py From qpid-python with Apache License 2.0 | 5 votes |
def install(self): outfiles = _install_lib.install(self) extra = [] for of in outfiles: if os.path.basename(of) == "amqp-0-10-qpid-errata-stripped.xml": tgt = pclfile(of) if self.force or newer(of, tgt): log.info("caching %s to %s" % (of, os.path.basename(tgt))) if not self.dry_run: from qpid.ops import load_types load_types(of) extra.append(tgt) return outfiles + extra
Example #30
Source File: setup.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def configuration(parent_package='', top_path=None): config = Configuration('f2py', parent_package, top_path) config.add_data_dir('tests') config.add_data_files('src/fortranobject.c', 'src/fortranobject.h', ) config.make_svn_version_py() def generate_f2py_py(build_dir): f2py_exe = 'f2py' + os.path.basename(sys.executable)[6:] if f2py_exe[-4:] == '.exe': f2py_exe = f2py_exe[:-4] + '.py' if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py': f2py_exe = f2py_exe + '.py' target = os.path.join(build_dir, f2py_exe) if newer(__file__, target): log.info('Creating %s', target) f = open(target, 'w') f.write(_get_f2py_shebang() + '\n') mainloc = os.path.join(os.path.dirname(__file__), "__main__.py") with open(mainloc) as mf: f.write(mf.read()) f.close() return target config.add_scripts(generate_f2py_py) log.info('F2PY Version %s', config.get_version()) return config