Author: Antonio Cuni <[email protected]>
Branch:
Changeset: r523:03cc273d734b
Date: 2011-07-05 11:02 +0200
http://bitbucket.org/pypy/buildbot/changeset/03cc273d734b/
Log: actually update the *-latest symlinks
diff --git a/bot2/pypybuildbot/builds.py b/bot2/pypybuildbot/builds.py
--- a/bot2/pypybuildbot/builds.py
+++ b/bot2/pypybuildbot/builds.py
@@ -2,6 +2,7 @@
from buildbot.steps import source, shell, transfer, master
from buildbot.status.builder import SUCCESS
from buildbot.process.properties import WithProperties
+from pypybuildbot.util import symlink_force
import os
class ShellCmd(shell.ShellCommand):
@@ -46,7 +47,7 @@
except OSError:
pass
try:
- os.symlink(os.path.basename(self.masterdest), self.symlinkname)
+ symlink_force(os.path.basename(self.masterdest), self.symlinkname)
except OSError:
pass
diff --git a/bot2/pypybuildbot/test/test_util.py
b/bot2/pypybuildbot/test/test_util.py
new file mode 100644
--- /dev/null
+++ b/bot2/pypybuildbot/test/test_util.py
@@ -0,0 +1,10 @@
+from pypybuildbot import util
+
+def test_symlink_force(tmpdir):
+ one = tmpdir.join('one').ensure(file=True)
+ two = tmpdir.join('two').ensure(file=True)
+ latest = tmpdir.join('latest')
+ util.symlink_force(str(one), str(latest))
+ assert latest.readlink() == str(one)
+ util.symlink_force(str(two), str(latest))
+ assert latest.readlink() == str(two)
diff --git a/bot2/pypybuildbot/util.py b/bot2/pypybuildbot/util.py
--- a/bot2/pypybuildbot/util.py
+++ b/bot2/pypybuildbot/util.py
@@ -1,3 +1,4 @@
+import os
import socket
def we_are_debugging():
@@ -7,3 +8,12 @@
mod = __import__(name, {}, {}, ['__all__'])
reload(mod)
return mod
+
+def symlink_force(src, dst):
+ """
+ More or less equivalent to "ln -fs": it overwrites the destination, if it
+ exists
+ """
+ if os.path.lexists(dst):
+ os.remove(dst)
+ os.symlink(src, dst)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit