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'
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)

View File

@ -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()

View File

@ -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

View File

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

View File

@ -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)

View File

@ -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:

View File

@ -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')

View File

@ -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

View File

@ -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)

View File

@ -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()

View File

@ -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

View File

@ -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):

View File

@ -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']

View File

@ -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:

View File

@ -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)