setup: subclass build command
authorSimon Heimberg <simohe@besonet.ch>
Tue, 01 Nov 2011 20:13:53 +0100
changeset 15460 f9f0731dbc56
parent 15459 434c48e981b8
child 15468 99824055d323
setup: subclass build command
setup.py
--- a/setup.py	Tue Nov 01 20:13:52 2011 +0100
+++ b/setup.py	Tue Nov 01 20:13:53 2011 +0100
@@ -186,6 +186,12 @@
 except ImportError:
     version = 'unknown'
 
+class hgbuild(build):
+    # Insert hgbuildmo first so that files in mercurial/locale/ are found
+    # when build_py is run next.
+    sub_commands = [('build_mo', None),
+                   ] + build.sub_commands
+
 class hgbuildmo(build):
 
     description = "build translations (.mo files)"
@@ -217,10 +223,6 @@
             self.make_file([pofile], mobuildfile, spawn, (cmd,))
 
 
-# Insert hgbuildmo first so that files in mercurial/locale/ are found
-# when build_py is run next.
-build.sub_commands.insert(0, ('build_mo', None))
-
 class hgdist(Distribution):
     pure = 0
 
@@ -344,7 +346,8 @@
             fp.write(data)
             fp.close()
 
-cmdclass = {'build_mo': hgbuildmo,
+cmdclass = {'build': hgbuild,
+            'build_mo': hgbuildmo,
             'build_ext': hgbuildext,
             'build_py': hgbuildpy,
             'build_hgextindex': buildhgextindex,