Subject: [UFL-dev] UFL and buildbot

From: "Johannes Ring" <[email-masked]>
Date: Mon, 9 Mar 2009 15:31:53 +0100 (CET)

Hi,

I have a couple of issues regarding UFL and the buildbot:

1. The Windows buildslave failed during build. The following patch should
fix this:

--- a/setup.py  Sun Mar 08 20:18:58 2009 +0100
+++ b/setup.py  Mon Mar 09 15:19:26 2009 +0100
@@ -41,5 +41,5 @@
                  "scripts/ufl-convert",
                  "scripts/form2ufl"],
       packages = ["ufl", "ufl.algorithms"],
-      package_dir = {"ufl": "ufl/"},
+      package_dir = {"ufl": "ufl"},
       data_files = [("lib/pkgconfig", ["ufl-%d.pc" % major])])

2. The buildbot is not currently triggered by a commit. To fix this, add
the following line under the [hooks] section in .hg/hgrc:

changegroup.jhbuildbot = hg-notify UFL [email-masked]

3. Let me know if you want the buildbot to send an email to ufl-dev
if/when the build or tests fails.

Johannes

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Mon, 9 Mar 2009 15:45:02 +0100

> +++ b/setup.py  Mon Mar 09 15:19:26 2009 +0100

Done.

> changegroup.jhbuildbot = hg-notify UFL [email-masked]

Done.

> if/when the build or tests fails.

Yes please. We should keep it stable now.

Martin

---

From: "Johannes Ring" <[email-masked]>
Date: Mon, 9 Mar 2009 15:55:15 +0100 (CET)

Done.

Johannes

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Mon, 9 Mar 2009 16:03:01 +0100

I checked in a failing test, but nothing seems to be happening? How
long should it usually take?

Martin

---

From: "Johannes Ring" <[email-masked]>
Date: Tue, 10 Mar 2009 08:45:50 +0100 (CET)

> long should it usually take?

The buildbot starts to build UFL three minutes after a commit. The test
did fail as you can see from the log:

http://fenics.org:8080/builders/ufl-hardy-i386/builds/2/steps/ufl%20check/logs/stdio

The problem in this case is that test/test.py always exits with 0
(success) even if some tests failed. You should modify the test script to
return an exit code different from 0 on failure, e.g. replace the bottom
loop with this:

# Run tests
failed_tests = []
for test in tests:
    print "Running tests: %s" % test
    failure = system("python %s.py" % test)
    if failure:
        failed_tests.append(test)
    print ""

sys.exit(len(failed_tests))

Johannes

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Tue, 10 Mar 2009 08:47:54 +0100

Ok! Thanks.

Martin

---

From: "Johannes Ring" <[email-masked]>
Date: Tue, 10 Mar 2009 09:05:59 +0100 (CET)

The tests now failed on Windows but it was not reported to ufl-dev.
However, this was a problem with the buildbot and I have fixed that now.
The Windows problem is a familiar one and I will try come up with a patch.

Johannes

---

From: "Johannes Ring" <[email-masked]>
Date: Tue, 10 Mar 2009 09:48:10 +0100 (CET)

Here is the patch.

Johannes

On Tue, March 10, 2009 09:05, Johannes Ring wrote:
>>>>>>> 2. The buildbot is not currently triggered by a commit. To fix
>>>>>>> this,
>>>>>>> add
# HG changeset patch
# User Johannes Ring <[email-masked]>
# Date 1236674752 -3600
# Node ID 8e77e1867035b72e56ce86b371c674cb7971182f
# Parent  b9feb0644e955873c633339f3a75181bc3d8f865
Windows fix in setup.py (install batch files).

diff -r b9feb0644e95 -r 8e77e1867035 setup.py
--- a/setup.py	Tue Mar 10 08:51:06 2009 +0100
+++ b/setup.py	Tue Mar 10 09:45:52 2009 +0100
@@ -2,8 +2,9 @@
 
 from distutils.core import setup
 from distutils import sysconfig
-from os.path import join as pjoin
+from os.path import join as pjoin, split as psplit
 import sys
+import platform
 
 # Version number
 major = 0
@@ -29,18 +30,33 @@
 # FIXME: better way for this? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 file.close()
 
+scripts = [pjoin("scripts", "ufl-analyse"),
+           pjoin("scripts", "ufl2latex"),
+           pjoin("scripts", "ufl2pdf"),
+           pjoin("scripts", "ufl-convert"),
+           pjoin("scripts", "form2ufl")]
+
+if platform.system() == "Windows" or "bdist_wininst" in sys.argv:
+    # In the Windows command prompt we can't execute Python scripts 
+    # without a .py extension. A solution is to create batch files
+    # that runs the different scripts.
+    batch_files = []
+    for script in scripts:
+        batch_file = script + ".bat"
+        f = open(batch_file, "w")
+        f.write('python "%%~dp0\%s" %%*' % psplit(script)[1])
+        f.close()
+        batch_files.append(batch_file)
+    scripts.extend(batch_files)
+
 setup(name = "UFL",
       version = "%d.%d" % (major, minor),
       description = "Unified Form Language",
       author = "Martin Sandve Alnaes, Anders Logg",
       author_email = "[email-masked]",
       url = "http://www.fenics.org/ufl/",
-      scripts = ["scripts/ufl-analyse",
-                 "scripts/ufl2latex",
-                 "scripts/ufl2pdf",
-                 "scripts/ufl-convert",
-                 "scripts/form2ufl"],
+      scripts = scripts,
       packages = ["ufl", "ufl.algorithms"],
       package_dir = {"ufl": "ufl"},
-      data_files = [("lib/pkgconfig", ["ufl-%d.pc" % major])])
+      data_files = [(pjoin("lib", "pkgconfig"), ["ufl-%d.pc" % major])])