Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1:/tmp/cvs-serv12384
Modified Files:
distutils.py
Log Message:
enhance i18n support and better doc
Index: distutils.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/distutils.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** distutils.py 1 Nov 2003 15:21:20 -0000 1.8
--- distutils.py 5 Nov 2003 19:14:52 -0000 1.9
***************
*** 67,70 ****
--- 67,73 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.9 2003/11/05 19:14:52 dischi
+ # enhance i18n support and better doc
+ #
# Revision 1.8 2003/11/01 15:21:20 dischi
# better howto support
***************
*** 79,95 ****
# i18n support function for plugins
#
- # Revision 1.4 2003/10/19 14:04:19 dischi
- # bugfix
- #
- # Revision 1.3 2003/10/18 15:37:14 dischi
- # doc fix
- #
- # Revision 1.2 2003/10/18 13:32:05 dischi
- # Update example
- #
- # Revision 1.1 2003/10/18 13:04:42 dischi
- # add distutils
- #
- #
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
--- 82,85 ----
***************
*** 123,126 ****
--- 113,119 ----
def package_finder(result, dirname, names):
+ """
+ os.path.walk helper for 'src'
+ """
for name in names:
if os.path.splitext(name)[1] == '.py':
***************
*** 132,135 ****
--- 125,132 ----
def data_finder(result, dirname, names):
+ """
+ os.path.walk helper for data directories
+ """
+ Transform all files in
files = []
for name in names:
***************
*** 150,153 ****
--- 147,153 ----
def docbook_finder(result, dirname, names):
+ """
+ os.path.walk helper for docbook data files in Docs
+ """
files = []
for name in names:
***************
*** 162,167 ****
def check_libs(libs):
! # ok, this can't be done by setup it seems, so we have to do it
! # manually
if len(sys.argv) > 1 and sys.argv[1].lower() == 'install':
# check for needed libs
--- 162,168 ----
def check_libs(libs):
! """
! check for python libs installed
! """
if len(sys.argv) > 1 and sys.argv[1].lower() == 'install':
# check for needed libs
***************
*** 178,181 ****
--- 179,189 ----
def i18n(application):
+ """
+ i18n cmd support
+ """
+ global use_i18n
+ use_i18n = 1
+
+ # cmd == '18n'
if len(sys.argv) > 1 and sys.argv[1].lower() == 'i18n':
if len(sys.argv) > 2 and sys.argv[2].lower() == '--help':
***************
*** 191,197 ****
--- 199,225 ----
# arg i18n will update the pot file and maybe merge the po files
print 'updating pot file'
+
+ # for freevo main package: remember the skin settings
+ if application == 'freevo':
+ f = open('i18n/freevo.pot')
+ fxd_strings = []
+ add = 0
+ for line in f.readlines():
+ if line.find('Manualy added from fxd skin files') > 0:
+ add = 1
+ if add:
+ fxd_strings.append(line)
+ f.close()
+
os.system('(cd src ; find . -name \*.py | xargs xgettext -o ../i18n/%s.pot)'
% \
application)
+ # for freevo main package: restore the skin settings
+ if application == 'freevo':
+ f = open('freevo.pot', 'a')
+ for line in fxd_strings:
+ f.write(line)
+ f.close()
+
# if arg 2 is not --no-merge to the merge
if not (len(sys.argv) > 2 and sys.argv[2] == '--no-merge'):
***************
*** 205,208 ****
--- 233,242 ----
print
+ # do not run this function if --help is given
+ for a in sys.argv:
+ if a.lower() == '--help':
+ return
+
+ # generate mo files for 'i18n', 'sdist' and 'bdist_rpm'
if len(sys.argv) > 1 and sys.argv[1].lower() in ('i18n', 'sdist', 'bdist_rpm'):
# update the mo files
***************
*** 213,220 ****
mo = os.path.splitext(file)[0] + '.mo'
os.system('msgfmt -o %s %s' % (mo, file))
!
if len(sys.argv) > 1 and sys.argv[1].lower() == 'i18n':
sys.exit(0)
!
# create list of source files
package_dir = {}
--- 247,272 ----
mo = os.path.splitext(file)[0] + '.mo'
os.system('msgfmt -o %s %s' % (mo, file))
!
! # exit for cmd == 'i18n'
if len(sys.argv) > 1 and sys.argv[1].lower() == 'i18n':
sys.exit(0)
!
!
!
! def finalize():
! """
! some stuff after setup is finished
! """
! global use_i18n
! if use_i18n and len(sys.argv) > 1 and sys.argv[1].lower() == '--help-commands':
! print 'Special Commands for Freevo:'
! print ' i18n i18n help functions'
! print
!
!
!
! # use i18n command option
! use_i18n = 0
!
# create list of source files
package_dir = {}
***************
*** 232,233 ****
--- 284,286 ----
os.path.walk('./src/www/htdocs', data_finder, data_files)
os.path.walk('./i18n', data_finder, data_files)
+
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog