Xpra: Ticket #331: setup.py: no exit after clean

In xpra-0.9.0 source tree (extracted from released tars) python setup.py clean removes generated file "constants.pxi" and then immediately tries to re-create it again by using make_constants_pxi and cython:

removing Cython/build generated file: wimpiggy/lowlevel/constants.pxi
(re)generating /mnt/tmp/src/xpra/xpra-0.9.0/wimpiggy/lowlevel/constants.pxi

Besides it is undesirable for "clean" to depend on cython. Actually on Debian "clean" is called before source is built in isolated environment (i.e. pbuilder) so failure to invoke cython causes FTBFS even before attempted package built.

Probably this situation can be improved by exiting after clean as per my amateur patch below:

--- a/setup.py
+++ b/setup.py
@@ -374,8 +374,9 @@
         filename = os.path.join(os.getcwd(), x.replace("/", os.path.sep))
         if os.path.exists(filename):
             print("removing Cython/build generated file: %s" % x)
             os.unlink(filename)
+    sys.exit(0)
.
 if "clean" not in sys.argv:
     # Add build info to build_info.py file:
     import add_build_info


Sat, 11 May 2013 02:34:33 GMT - Antoine Martin: status changed; resolution set

The patch above is incorrect and breaks "sdist", and maybe some of the steps that setuptools takes (if any) for "clean" since we skip it completely.

Please see r3353 for a better approach, I will backport to 0.9.x (the list of files to clean is different in v0.9.x)


Sat, 11 May 2013 02:58:56 GMT - onlyjob:

Thank you very much for fixing it properly. I'm no match to your superior python skills. :)


Sat, 23 Jan 2021 04:51:54 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/331