Mercurial > p > roundup > code
comparison setup.py @ 2300:e98bb674cb7d
binary distribution includes compiled message catalogs
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Thu, 13 May 2004 20:12:32 +0000 |
| parents | 91118ac2fa7f |
| children | bf3d44f6b91e |
comparison
equal
deleted
inserted
replaced
| 2299:9fffd2035b33 | 2300:e98bb674cb7d |
|---|---|
| 13 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | 13 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 18 # | 18 # |
| 19 # $Id: setup.py,v 1.64 2004-05-05 02:05:43 richard Exp $ | 19 # $Id: setup.py,v 1.65 2004-05-13 20:12:32 a1s Exp $ |
| 20 | 20 |
| 21 from distutils.core import setup, Extension | 21 from distutils.core import setup, Extension |
| 22 from distutils.util import get_platform | 22 from distutils.util import get_platform |
| 23 from distutils.command.build_scripts import build_scripts | 23 from distutils.command.build_scripts import build_scripts |
| 24 from distutils.command.build import build | 24 from distutils.command.build import build |
| 49 run() function in the module | 49 run() function in the module |
| 50 | 50 |
| 51 <packagename>.scripts.<mangled_scriptname> | 51 <packagename>.scripts.<mangled_scriptname> |
| 52 | 52 |
| 53 The mangling of script names replaces '-' and '/' characters | 53 The mangling of script names replaces '-' and '/' characters |
| 54 with '-' and '.', so that they are valid module paths. | 54 with '-' and '.', so that they are valid module paths. |
| 55 """ | 55 """ |
| 56 package_name = None | 56 package_name = None |
| 57 | 57 |
| 58 def copy_scripts(self): | 58 def copy_scripts(self): |
| 59 """ Create each script listed in 'self.scripts' | 59 """ Create each script listed in 'self.scripts' |
| 60 """ | 60 """ |
| 61 if not self.package_name: | 61 if not self.package_name: |
| 62 raise Exception("You have to inherit build_scripts_create and" | 62 raise Exception("You have to inherit build_scripts_create and" |
| 63 " provide a package name") | 63 " provide a package name") |
| 64 | 64 |
| 65 to_module = string.maketrans('-/', '_.') | 65 to_module = string.maketrans('-/', '_.') |
| 66 | 66 |
| 67 self.mkpath(self.build_dir) | 67 self.mkpath(self.build_dir) |
| 68 for script in self.scripts: | 68 for script in self.scripts: |
| 69 outfile = os.path.join(self.build_dir, os.path.basename(script)) | 69 outfile = os.path.join(self.build_dir, os.path.basename(script)) |
| 126 script = os.path.splitext(os.path.basename(path))[0] | 126 script = os.path.splitext(os.path.basename(path))[0] |
| 127 script = string.replace(script, '_', '-') | 127 script = string.replace(script, '_', '-') |
| 128 if sys.platform == "win32": | 128 if sys.platform == "win32": |
| 129 script = script + ".bat" | 129 script = script + ".bat" |
| 130 return script | 130 return script |
| 131 | |
| 132 ### Build Roundup | |
| 133 | |
| 134 def list_po_files(): | |
| 135 """Return list of all found message files""" | |
| 136 return glob("locale/*/LC_MESSAGES/*.po") | |
| 137 | |
| 138 def compile_po_files(): | |
| 139 """Compile all .po files in locale directory""" | |
| 140 # locate the tools directory | |
| 141 if sys.platform == "win32": | |
| 142 _share = sys.prefix | |
| 143 else: | |
| 144 _share = os.path.join(sys.prefix, "share", | |
| 145 "python%i.%i" % sys.version_info[:2]) | |
| 146 # import message formatter | |
| 147 sys.path.insert(0, os.path.join(_share, "Tools", "i18n")) | |
| 148 import msgfmt | |
| 149 # compile messages | |
| 150 for _file in list_po_files(): | |
| 151 msgfmt.make(_file, None) | |
| 131 | 152 |
| 132 def check_manifest(): | 153 def check_manifest(): |
| 133 """Check that the files listed in the MANIFEST are present when the | 154 """Check that the files listed in the MANIFEST are present when the |
| 134 source is unpacked. | 155 source is unpacked. |
| 135 """ | 156 """ |
| 152 | 173 |
| 153 | 174 |
| 154 class build_roundup(build): | 175 class build_roundup(build): |
| 155 def run(self): | 176 def run(self): |
| 156 check_manifest() | 177 check_manifest() |
| 178 compile_po_files() | |
| 157 build.run(self) | 179 build.run(self) |
| 158 | 180 |
| 159 ############################################################################# | 181 ############################################################################# |
| 160 ### Main setup stuff | 182 ### Main setup stuff |
| 161 ############################################################################# | 183 ############################################################################# |
| 174 'roundup.backends', | 196 'roundup.backends', |
| 175 'roundup.scripts' | 197 'roundup.scripts' |
| 176 ] | 198 ] |
| 177 installdatafiles = [ | 199 installdatafiles = [ |
| 178 ('share/roundup/cgi-bin', ['cgi-bin/roundup.cgi']), | 200 ('share/roundup/cgi-bin', ['cgi-bin/roundup.cgi']), |
| 179 ] | 201 ] |
| 180 | 202 |
| 181 # install man pages on POSIX platforms | 203 # install man pages on POSIX platforms |
| 182 if os.name == 'posix': | 204 if os.name == 'posix': |
| 183 installdatafiles.append(('man/man1', ['doc/roundup-admin.1', | 205 installdatafiles.append(('man/man1', ['doc/roundup-admin.1', |
| 184 'doc/roundup-mailgw.1', 'doc/roundup-server.1'])) | 206 'doc/roundup-mailgw.1', 'doc/roundup-server.1'])) |
| 199 tfiles.append(ifile) | 221 tfiles.append(ifile) |
| 200 installdatafiles.append( | 222 installdatafiles.append( |
| 201 (os.path.join('share', 'roundup', idir), tfiles) | 223 (os.path.join('share', 'roundup', idir), tfiles) |
| 202 ) | 224 ) |
| 203 | 225 |
| 226 # add message files | |
| 227 _po_files = list_po_files() | |
| 228 for _file in _po_files: | |
| 229 # change .po to .mo - will be compiled by build | |
| 230 _file = os.path.splitext(_file)[0] + ".mo" | |
| 231 installdatafiles.append((os.path.join("share", os.path.dirname(_file)), | |
| 232 [_file])) | |
| 233 | |
| 204 # perform the setup action | 234 # perform the setup action |
| 205 from roundup import __version__ | 235 from roundup import __version__ |
| 206 setup( | 236 setup( |
| 207 name = "roundup", | 237 name = "roundup", |
| 208 version = __version__, | 238 version = __version__, |
| 209 description = "A simple-to-use and -install issue-tracking system" | 239 description = "A simple-to-use and -install issue-tracking system" |
| 210 " with command-line, web and e-mail interfaces. Highly" | 240 " with command-line, web and e-mail interfaces. Highly" |
| 211 " customisable.", | 241 " customisable.", |
| 212 long_description = | 242 long_description = |
| 213 '''Roundup is a simple-to-use and -install issue-tracking system with | 243 '''Roundup is a simple-to-use and -install issue-tracking system with |
| 214 command-line, web and e-mail interfaces. It is based on the winning design | 244 command-line, web and e-mail interfaces. It is based on the winning design |
| 215 from Ka-Ping Yee in the Software Carpentry "Track" design competition. | 245 from Ka-Ping Yee in the Software Carpentry "Track" design competition. |
| 216 | 246 |
| 217 If you're upgrading from an older version of Roundup you *must* follow | 247 If you're upgrading from an older version of Roundup you *must* follow |
