changeset 542:a09f6990eab4

Add a hack to prevent `setup.py clean` from compiling Cython files.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 11 May 2014 13:16:19 +0200
parents 8895ede4e51e
children fb837b32c3dd
files setup.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py
+++ b/setup.py
@@ -28,6 +28,18 @@ anmviewer = False  # It’s currently broken anyway.
 use_opengl = True  # Compile the OpenGL backend if True
 nthreads = 4  # How many processes to use for Cython compilation.
 
+
+# Hack to prevent `setup.py clean` from compiling Cython files.
+if sys.argv[1] == 'clean':
+    import shutil
+    shutil.rmtree('build', ignore_errors=True)
+    for directory, _, files in os.walk('pytouhou'):
+        for filename in files:
+            if filename.endswith('.c'):
+                os.unlink(os.path.join(directory, filename))
+    sys.exit(0)
+
+
 default_libs = {
     'sdl2': '-lSDL2',
     'SDL2_image': '-lSDL2_image',