setup.py
changeset 15460 f9f0731dbc56
parent 15459 434c48e981b8
child 15492 36f076d03b34
equal deleted inserted replaced
15459:434c48e981b8 15460:f9f0731dbc56
   184     from mercurial import __version__
   184     from mercurial import __version__
   185     version = __version__.version
   185     version = __version__.version
   186 except ImportError:
   186 except ImportError:
   187     version = 'unknown'
   187     version = 'unknown'
   188 
   188 
       
   189 class hgbuild(build):
       
   190     # Insert hgbuildmo first so that files in mercurial/locale/ are found
       
   191     # when build_py is run next.
       
   192     sub_commands = [('build_mo', None),
       
   193                    ] + build.sub_commands
       
   194 
   189 class hgbuildmo(build):
   195 class hgbuildmo(build):
   190 
   196 
   191     description = "build translations (.mo files)"
   197     description = "build translations (.mo files)"
   192 
   198 
   193     def run(self):
   199     def run(self):
   215                 cmd.append('-c')
   221                 cmd.append('-c')
   216             self.mkpath(join('mercurial', modir))
   222             self.mkpath(join('mercurial', modir))
   217             self.make_file([pofile], mobuildfile, spawn, (cmd,))
   223             self.make_file([pofile], mobuildfile, spawn, (cmd,))
   218 
   224 
   219 
   225 
   220 # Insert hgbuildmo first so that files in mercurial/locale/ are found
       
   221 # when build_py is run next.
       
   222 build.sub_commands.insert(0, ('build_mo', None))
       
   223 
       
   224 class hgdist(Distribution):
   226 class hgdist(Distribution):
   225     pure = 0
   227     pure = 0
   226 
   228 
   227     global_options = Distribution.global_options + \
   229     global_options = Distribution.global_options + \
   228                      [('pure', None, "use pure (slow) Python "
   230                      [('pure', None, "use pure (slow) Python "
   342             data = data.replace('@LIBDIR@', libdir.encode('string_escape'))
   344             data = data.replace('@LIBDIR@', libdir.encode('string_escape'))
   343             fp = open(outfile, 'wb')
   345             fp = open(outfile, 'wb')
   344             fp.write(data)
   346             fp.write(data)
   345             fp.close()
   347             fp.close()
   346 
   348 
   347 cmdclass = {'build_mo': hgbuildmo,
   349 cmdclass = {'build': hgbuild,
       
   350             'build_mo': hgbuildmo,
   348             'build_ext': hgbuildext,
   351             'build_ext': hgbuildext,
   349             'build_py': hgbuildpy,
   352             'build_py': hgbuildpy,
   350             'build_hgextindex': buildhgextindex,
   353             'build_hgextindex': buildhgextindex,
   351             'install_scripts': hginstallscripts}
   354             'install_scripts': hginstallscripts}
   352 
   355