Mercurial > p > roundup > code
comparison setup.py @ 2303:bf3d44f6b91e
reorganized locale sources:
all message source files are now kept in one directory. actual locale
tree is created in the 'build' subdirectory.
added log message about compilation of .po files
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Fri, 14 May 2004 18:32:58 +0000 |
| parents | e98bb674cb7d |
| children | f8a4c51e5847 |
comparison
equal
deleted
inserted
replaced
| 2302:004dff9a159f | 2303:bf3d44f6b91e |
|---|---|
| 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.65 2004-05-13 20:12:32 a1s Exp $ | 19 # $Id: setup.py,v 1.66 2004-05-14 18:32:58 a1s Exp $ |
| 20 | 20 |
| 21 from distutils import log | |
| 21 from distutils.core import setup, Extension | 22 from distutils.core import setup, Extension |
| 22 from distutils.util import get_platform | 23 from distutils.util import get_platform |
| 23 from distutils.command.build_scripts import build_scripts | 24 from distutils.command.build_scripts import build_scripts |
| 24 from distutils.command.build import build | 25 from distutils.command.build import build |
| 25 | 26 |
| 130 return script | 131 return script |
| 131 | 132 |
| 132 ### Build Roundup | 133 ### Build Roundup |
| 133 | 134 |
| 134 def list_po_files(): | 135 def list_po_files(): |
| 135 """Return list of all found message files""" | 136 """Return list of all found message files and their intallation paths""" |
| 136 return glob("locale/*/LC_MESSAGES/*.po") | 137 _files = glob("locale/*.po") |
| 138 _list = [] | |
| 139 for _file in _files: | |
| 140 # basename (without extension) is a locale name | |
| 141 _locale = os.path.splitext(os.path.basename(_file))[0] | |
| 142 _list.append((_file, os.path.join( | |
| 143 "share", "locale", _locale, "LC_MESSAGES", "roundup.mo"))) | |
| 144 return _list | |
| 137 | 145 |
| 138 def compile_po_files(): | 146 def compile_po_files(): |
| 139 """Compile all .po files in locale directory""" | 147 """Compile all .po files in locale directory""" |
| 140 # locate the tools directory | 148 # locate the tools directory |
| 141 if sys.platform == "win32": | 149 if sys.platform == "win32": |
| 145 "python%i.%i" % sys.version_info[:2]) | 153 "python%i.%i" % sys.version_info[:2]) |
| 146 # import message formatter | 154 # import message formatter |
| 147 sys.path.insert(0, os.path.join(_share, "Tools", "i18n")) | 155 sys.path.insert(0, os.path.join(_share, "Tools", "i18n")) |
| 148 import msgfmt | 156 import msgfmt |
| 149 # compile messages | 157 # compile messages |
| 150 for _file in list_po_files(): | 158 for (_po, _mo) in list_po_files(): |
| 151 msgfmt.make(_file, None) | 159 _mo = os.path.join("build", _mo) |
| 160 _dir = os.path.dirname(_mo) | |
| 161 if not os.path.isdir(_dir): | |
| 162 os.makedirs(_dir) | |
| 163 log.info("Compiling messages in %r => %r", _po, _mo) | |
| 164 msgfmt.make(_po, _mo) | |
| 152 | 165 |
| 153 def check_manifest(): | 166 def check_manifest(): |
| 154 """Check that the files listed in the MANIFEST are present when the | 167 """Check that the files listed in the MANIFEST are present when the |
| 155 source is unpacked. | 168 source is unpacked. |
| 156 """ | 169 """ |
| 223 (os.path.join('share', 'roundup', idir), tfiles) | 236 (os.path.join('share', 'roundup', idir), tfiles) |
| 224 ) | 237 ) |
| 225 | 238 |
| 226 # add message files | 239 # add message files |
| 227 _po_files = list_po_files() | 240 _po_files = list_po_files() |
| 228 for _file in _po_files: | 241 for (_po_file, _mo_file) in list_po_files(): |
| 229 # change .po to .mo - will be compiled by build | 242 installdatafiles.append((os.path.dirname(_mo_file), |
| 230 _file = os.path.splitext(_file)[0] + ".mo" | 243 [os.path.join("build", _mo_file)])) |
| 231 installdatafiles.append((os.path.join("share", os.path.dirname(_file)), | |
| 232 [_file])) | |
| 233 | 244 |
| 234 # perform the setup action | 245 # perform the setup action |
| 235 from roundup import __version__ | 246 from roundup import __version__ |
| 236 setup( | 247 setup( |
| 237 name = "roundup", | 248 name = "roundup", |
