2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 09:57:15 +01:00

use os.remove instead of os.unlink for consistency

This commit is contained in:
Thomas Nagy 2013-05-18 19:51:45 +02:00
parent 426637d10a
commit 6d570f08bd
15 changed files with 21 additions and 22 deletions

4
README
View File

@ -25,7 +25,7 @@ how to create a waf file using the compat15 module:
$ ./waf-light --tools=compat15 --prelude=$'\tfrom waflib.extras import compat15\n' $ ./waf-light --tools=compat15 --prelude=$'\tfrom waflib.extras import compat15\n'
Any kind of initialization is possible, though one may prefer the build system kit (folder build_system_kit): Any kind of initialization is possible, though one may prefer the build system kit (folder build_system_kit):
$ ./waf-light --make-waf --tools=compat15,/comp/waf/aba.py --prelude=$'\tfrom waflib.extras import compat15\n\tprint "ok"' $ ./waf-light --make-waf --tools=compat15,/comp/waf/aba.py --prelude=$'\tfrom waflib.extras import compat15\n\tprint("ok")'
HOW TO TRY THE EXAMPLES HOW TO TRY THE EXAMPLES
----------------------- -----------------------
@ -46,5 +46,5 @@ $ git remote add code https://code.google.com/p/waf.docs/
$ git push code $ git push code
--------------------------- ---------------------------
Thomas Nagy, 2012 (ita) Thomas Nagy, 2013 (ita)

View File

@ -73,7 +73,7 @@ def try_compress(self):
store[1] = siz store[1] = siz
os.rename(filename, self.generator.bld.bldnode.abspath() + os.sep + 'max%d.tar.%s' % (siz, ext)) os.rename(filename, self.generator.bld.bldnode.abspath() + os.sep + 'max%d.tar.%s' % (siz, ext))
else: else:
os.unlink(filename) os.remove(filename)
finally: finally:
lock.release() lock.release()

View File

@ -46,9 +46,9 @@ def lock_maxjob(self):
def release_maxjob(self): def release_maxjob(self):
# release the lock file # release the lock file
print "> long task %d" % (time.time() - self.start_time) print("> long task %d" % (time.time() - self.start_time))
try: try:
os.unlink(self.generator.bld.lockfile) os.remove(self.generator.bld.lockfile)
os.close(self.lockfd) os.close(self.lockfd)
except OSError, e: except OSError, e:
# of someone else has removed the lock... bad luck! but do not fail here # of someone else has removed the lock... bad luck! but do not fail here

View File

@ -58,5 +58,5 @@ def distclean(ctx):
if os.path.isdir(fn): if os.path.isdir(fn):
shutil.rmtree(fn) shutil.rmtree(fn)
else: else:
os.unlink(fn) os.remove(fn)

View File

@ -239,14 +239,14 @@ run
for tgen in bld.get_all_task_gen(): for tgen in bld.get_all_task_gen():
for tgt in waflib.Utils.to_list(tgen.target): for tgt in waflib.Utils.to_list(tgen.target):
if os.path.exists(tgt): if os.path.exists(tgt):
os.unlink(tgt) os.remove(tgt)
for x in ( for x in (
'usage_statistics_webtalk.html', 'usage_statistics_webtalk.html',
'webtalk_pn.xml', 'webtalk_pn.xml',
'webtalk.log', 'webtalk.log',
): ):
if os.path.exists(x): if os.path.exists(x):
os.unlink(x) os.remove(x)
for x in ( for x in (
'_ngo', '_ngo',
@ -271,6 +271,6 @@ def distclean(ctx):
if os.path.isdir(fn): if os.path.isdir(fn):
shutil.rmtree(fn) shutil.rmtree(fn)
else: else:
os.unlink(fn) os.remove(fn)

View File

@ -21,8 +21,8 @@ def remove(path):
try: try:
try: try:
os.listdir(path) os.listdir(path)
except: except OSError:
os.unlink(path) os.remove(path)
else: else:
shutil.rmtree(path) shutil.rmtree(path)
except: except:

View File

@ -110,7 +110,7 @@ def unpack_wafdir(dir):
import fixpy2 import fixpy2
fixpy2.fixdir(dir) fixpy2.fixdir(dir)
os.unlink(tmp) os.remove(tmp)
os.chdir(cwd) os.chdir(cwd)
try: dir = unicode(dir, 'mbcs') try: dir = unicode(dir, 'mbcs')

View File

@ -339,7 +339,7 @@ class BuildContext(Context.Context):
try: try:
st = os.stat(db) st = os.stat(db)
os.unlink(db) os.remove(db)
if not Utils.is_win32: # win32 has no chown but we're paranoid if not Utils.is_win32: # win32 has no chown but we're paranoid
os.chown(db + '.tmp', st.st_uid, st.st_gid) os.chown(db + '.tmp', st.st_uid, st.st_gid)
except (AttributeError, OSError): except (AttributeError, OSError):
@ -1158,7 +1158,7 @@ class UninstallContext(InstallContext):
"""See :py:meth:`waflib.Build.InstallContext.do_link`""" """See :py:meth:`waflib.Build.InstallContext.do_link`"""
try: try:
if not self.progress_bar: if not self.progress_bar:
Logs.info('- unlink %s' % tgt) Logs.info('- remove %s' % tgt)
os.remove(tgt) os.remove(tgt)
except OSError: except OSError:
pass pass

View File

@ -42,7 +42,7 @@ class ConfigSet(object):
Enable the *in* syntax:: Enable the *in* syntax::
if 'foo' in env: if 'foo' in env:
print env['foo'] print(env['foo'])
""" """
if key in self.table: return True if key in self.table: return True
try: return self.parent.__contains__(key) try: return self.parent.__contains__(key)

View File

@ -188,7 +188,7 @@ class Node(object):
if hasattr(self, 'children'): if hasattr(self, 'children'):
shutil.rmtree(self.abspath()) shutil.rmtree(self.abspath())
else: else:
os.unlink(self.abspath()) os.remove(self.abspath())
except OSError: except OSError:
pass pass
self.evict() self.evict()

View File

@ -256,13 +256,13 @@ def distclean_dir(dirname):
if _can_distclean(f): if _can_distclean(f):
fname = root + os.sep + f fname = root + os.sep + f
try: try:
os.unlink(fname) os.remove(fname)
except OSError: except OSError:
Logs.warn('Could not remove %r' % fname) Logs.warn('Could not remove %r' % fname)
for x in [Context.DBFILE, 'config.log']: for x in [Context.DBFILE, 'config.log']:
try: try:
os.unlink(x) os.remove(x)
except OSError: except OSError:
pass pass

View File

@ -302,7 +302,7 @@ class javac(Task.Task):
ret = self.exec_command(cmd, cwd=wd, env=env.env or None) ret = self.exec_command(cmd, cwd=wd, env=env.env or None)
finally: finally:
if tmp: if tmp:
os.unlink(tmp) os.remove(tmp)
return ret return ret
def post_run(self): def post_run(self):

View File

@ -257,7 +257,6 @@ class qxx(Task.classes['cxx']):
# simple scheduler dependency: run the moc task before others # simple scheduler dependency: run the moc task before others
self.run_after.update(set(moctasks)) self.run_after.update(set(moctasks))
print self.outputs, self.run_after
self.moc_done = 1 self.moc_done = 1
run = Task.classes['cxx'].__dict__['run'] run = Task.classes['cxx'].__dict__['run']

View File

@ -86,7 +86,7 @@ def post_run(self):
name = self.outputs[0].abspath() name = self.outputs[0].abspath()
name = re_o.sub('.d', name) name = re_o.sub('.d', name)
txt = Utils.readf(name) txt = Utils.readf(name)
#os.unlink(name) #os.remove(name)
# Compilers have the choice to either output the file's dependencies # Compilers have the choice to either output the file's dependencies
# as one large Makefile rule: # as one large Makefile rule:

View File

@ -360,7 +360,7 @@ def create_waf(*k, **kw):
if sys.platform != 'win32': if sys.platform != 'win32':
os.chmod('waf', Utils.O755) os.chmod('waf', Utils.O755)
os.unlink('%s.tar.%s' % (mw, zipType)) os.remove('%s.tar.%s' % (mw, zipType))
def make_copy(inf, outf): def make_copy(inf, outf):
(a, b, cnt) = sfilter(inf) (a, b, cnt) = sfilter(inf)