From 6d570f08bdf76a13846f700899054818a5031f82 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sat, 18 May 2013 19:51:45 +0200 Subject: [PATCH] use os.remove instead of os.unlink for consistency --- README | 4 ++-- playground/compress/wscript | 2 +- playground/maxjobs2/compute/wscript | 4 ++-- playground/top_eq_out/wscript | 2 +- playground/xilinx-ise/wscript | 6 +++--- tests/apis/wscript | 4 ++-- waf-light | 2 +- waflib/Build.py | 4 ++-- waflib/ConfigSet.py | 2 +- waflib/Node.py | 2 +- waflib/Scripting.py | 4 ++-- waflib/Tools/javaw.py | 2 +- waflib/Tools/qt4.py | 1 - waflib/extras/gccdeps.py | 2 +- wscript | 2 +- 15 files changed, 21 insertions(+), 22 deletions(-) diff --git a/README b/README index 202005e1..136af7dd 100644 --- a/README +++ b/README @@ -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' 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 ----------------------- @@ -46,5 +46,5 @@ $ git remote add code https://code.google.com/p/waf.docs/ $ git push code --------------------------- -Thomas Nagy, 2012 (ita) +Thomas Nagy, 2013 (ita) diff --git a/playground/compress/wscript b/playground/compress/wscript index 14352771..fc14c62e 100644 --- a/playground/compress/wscript +++ b/playground/compress/wscript @@ -73,7 +73,7 @@ def try_compress(self): store[1] = siz os.rename(filename, self.generator.bld.bldnode.abspath() + os.sep + 'max%d.tar.%s' % (siz, ext)) else: - os.unlink(filename) + os.remove(filename) finally: lock.release() diff --git a/playground/maxjobs2/compute/wscript b/playground/maxjobs2/compute/wscript index 12bb513d..b95da2a3 100644 --- a/playground/maxjobs2/compute/wscript +++ b/playground/maxjobs2/compute/wscript @@ -46,9 +46,9 @@ def lock_maxjob(self): def release_maxjob(self): # release the lock file - print "> long task %d" % (time.time() - self.start_time) + print("> long task %d" % (time.time() - self.start_time)) try: - os.unlink(self.generator.bld.lockfile) + os.remove(self.generator.bld.lockfile) os.close(self.lockfd) except OSError, e: # of someone else has removed the lock... bad luck! but do not fail here diff --git a/playground/top_eq_out/wscript b/playground/top_eq_out/wscript index 5699223e..8142c10d 100644 --- a/playground/top_eq_out/wscript +++ b/playground/top_eq_out/wscript @@ -58,5 +58,5 @@ def distclean(ctx): if os.path.isdir(fn): shutil.rmtree(fn) else: - os.unlink(fn) + os.remove(fn) diff --git a/playground/xilinx-ise/wscript b/playground/xilinx-ise/wscript index e07d73b1..df467a99 100644 --- a/playground/xilinx-ise/wscript +++ b/playground/xilinx-ise/wscript @@ -239,14 +239,14 @@ run for tgen in bld.get_all_task_gen(): for tgt in waflib.Utils.to_list(tgen.target): if os.path.exists(tgt): - os.unlink(tgt) + os.remove(tgt) for x in ( 'usage_statistics_webtalk.html', 'webtalk_pn.xml', 'webtalk.log', ): if os.path.exists(x): - os.unlink(x) + os.remove(x) for x in ( '_ngo', @@ -271,6 +271,6 @@ def distclean(ctx): if os.path.isdir(fn): shutil.rmtree(fn) else: - os.unlink(fn) + os.remove(fn) diff --git a/tests/apis/wscript b/tests/apis/wscript index c6b2c2dc..62777a66 100755 --- a/tests/apis/wscript +++ b/tests/apis/wscript @@ -21,8 +21,8 @@ def remove(path): try: try: os.listdir(path) - except: - os.unlink(path) + except OSError: + os.remove(path) else: shutil.rmtree(path) except: diff --git a/waf-light b/waf-light index 471e65b1..6299cd13 100755 --- a/waf-light +++ b/waf-light @@ -110,7 +110,7 @@ def unpack_wafdir(dir): import fixpy2 fixpy2.fixdir(dir) - os.unlink(tmp) + os.remove(tmp) os.chdir(cwd) try: dir = unicode(dir, 'mbcs') diff --git a/waflib/Build.py b/waflib/Build.py index 9ac16146..26885a9d 100644 --- a/waflib/Build.py +++ b/waflib/Build.py @@ -339,7 +339,7 @@ class BuildContext(Context.Context): try: st = os.stat(db) - os.unlink(db) + os.remove(db) if not Utils.is_win32: # win32 has no chown but we're paranoid os.chown(db + '.tmp', st.st_uid, st.st_gid) except (AttributeError, OSError): @@ -1158,7 +1158,7 @@ class UninstallContext(InstallContext): """See :py:meth:`waflib.Build.InstallContext.do_link`""" try: if not self.progress_bar: - Logs.info('- unlink %s' % tgt) + Logs.info('- remove %s' % tgt) os.remove(tgt) except OSError: pass diff --git a/waflib/ConfigSet.py b/waflib/ConfigSet.py index f3d1ccd7..32c28a5d 100644 --- a/waflib/ConfigSet.py +++ b/waflib/ConfigSet.py @@ -42,7 +42,7 @@ class ConfigSet(object): Enable the *in* syntax:: if 'foo' in env: - print env['foo'] + print(env['foo']) """ if key in self.table: return True try: return self.parent.__contains__(key) diff --git a/waflib/Node.py b/waflib/Node.py index 2b48f217..dce98fda 100644 --- a/waflib/Node.py +++ b/waflib/Node.py @@ -188,7 +188,7 @@ class Node(object): if hasattr(self, 'children'): shutil.rmtree(self.abspath()) else: - os.unlink(self.abspath()) + os.remove(self.abspath()) except OSError: pass self.evict() diff --git a/waflib/Scripting.py b/waflib/Scripting.py index 47e550c5..9e6e69cc 100644 --- a/waflib/Scripting.py +++ b/waflib/Scripting.py @@ -256,13 +256,13 @@ def distclean_dir(dirname): if _can_distclean(f): fname = root + os.sep + f try: - os.unlink(fname) + os.remove(fname) except OSError: Logs.warn('Could not remove %r' % fname) for x in [Context.DBFILE, 'config.log']: try: - os.unlink(x) + os.remove(x) except OSError: pass diff --git a/waflib/Tools/javaw.py b/waflib/Tools/javaw.py index 3ab971a6..5e6c6d0d 100644 --- a/waflib/Tools/javaw.py +++ b/waflib/Tools/javaw.py @@ -302,7 +302,7 @@ class javac(Task.Task): ret = self.exec_command(cmd, cwd=wd, env=env.env or None) finally: if tmp: - os.unlink(tmp) + os.remove(tmp) return ret def post_run(self): diff --git a/waflib/Tools/qt4.py b/waflib/Tools/qt4.py index 195532ca..7741a5d8 100644 --- a/waflib/Tools/qt4.py +++ b/waflib/Tools/qt4.py @@ -257,7 +257,6 @@ class qxx(Task.classes['cxx']): # simple scheduler dependency: run the moc task before others self.run_after.update(set(moctasks)) - print self.outputs, self.run_after self.moc_done = 1 run = Task.classes['cxx'].__dict__['run'] diff --git a/waflib/extras/gccdeps.py b/waflib/extras/gccdeps.py index 94fc3a2c..b19370f8 100644 --- a/waflib/extras/gccdeps.py +++ b/waflib/extras/gccdeps.py @@ -86,7 +86,7 @@ def post_run(self): name = self.outputs[0].abspath() name = re_o.sub('.d', name) txt = Utils.readf(name) - #os.unlink(name) + #os.remove(name) # Compilers have the choice to either output the file's dependencies # as one large Makefile rule: diff --git a/wscript b/wscript index 12586192..039843eb 100644 --- a/wscript +++ b/wscript @@ -360,7 +360,7 @@ def create_waf(*k, **kw): if sys.platform != 'win32': os.chmod('waf', Utils.O755) - os.unlink('%s.tar.%s' % (mw, zipType)) + os.remove('%s.tar.%s' % (mw, zipType)) def make_copy(inf, outf): (a, b, cnt) = sfilter(inf)