1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 20:38:00 +01:00

Fixed get_translations and renamed cleargenerated to clear_generated

This commit is contained in:
Adam Blackburn
2009-03-12 17:55:16 +08:00
parent f4fc8ae949
commit 0306b57800

View File

@@ -289,7 +289,7 @@ class configure(Command):
item_in.close() item_in.close()
shutil.copymode(original_name, final_name) shutil.copymode(original_name, final_name)
class cleargenerated(Command): class clear_generated(Command):
description = 'clears out files generated by configure' description = 'clears out files generated by configure'
user_options = [] user_options = []
@@ -346,21 +346,22 @@ class get_translations(Command):
import urllib, shutil import urllib, shutil
shutil.rmtree('translations/') shutil.rmtree('translations/')
os.makedirs('translations') os.makedirs('translations')
filename, headers = urllib.urlretrieve('http://wicd.net/translator/get_id_list.php') filename, headers = urllib.urlretrieve('http://wicd.net/translator/idlist')
id_file = open(filename, 'r') id_file = open(filename, 'r')
lines = id_file.readlines() lines = id_file.readlines()
# remove the \n from the end of lines, and remove blank entries # remove the \n from the end of lines, and remove blank entries
lines = [ x.strip() for x in lines if not x.strip() is '' ] lines = [ x.strip() for x in lines if not x.strip() is '' ]
for id in lines: for id in lines:
# http://wicd.net/translator/download_po.php?language=11 # http://wicd.net/translator/download_po.php?language=11
pofile, poheaders = urllib.urlretrieve('http://wicd.net/translator/download_po.php?language='+str(id)) pofile, poheaders = urllib.urlretrieve('http://wicd.net/translator/download/'+str(id))
#for i in `cat ids`; do #for i in `cat ids`; do
#wget "http://wicd.sourceforge.net/translator/download_po.php?language=$i&version=$1" -O "language_$i" #wget "http://wicd.sourceforge.net/translator/download_po.php?language=$i&version=$1" -O "language_$i"
#iden=`python -c "import sys; print open('language_$i','r').readlines()[1].strip()[2:]"` #iden=`python -c "import sys; print open('language_$i','r').readlines()[1].strip()[2:]"`
#mv "language_$i" po/$iden.po #mv "language_$i" po/$iden.po
#mkdir -p $iden/LC_MESSAGES/ #mkdir -p $iden/LC_MESSAGES/
#msgfmt --output-file=$iden/LC_MESSAGES/wicd.mo po/$iden.po #msgfmt --output-file=$iden/LC_MESSAGES/wicd.mo po/$iden.po
lang_identifier = open(pofile,'r').readlines()[1].strip()[2:] lang_identifier = open(pofile,'r').readlines()[0].strip()
lang_identifier = lang_identifier[lang_identifier.rindex('(')+1:lang_identifier.rindex(')')]
shutil.move(pofile, lang_identifier+'.po') shutil.move(pofile, lang_identifier+'.po')
print 'Got',lang_identifier print 'Got',lang_identifier
os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES') os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES')
@@ -486,7 +487,7 @@ iwscan_ext = Extension(name = 'iwscan', libraries = ['iw'],
sources = ['depends/python-iwscan/pyiwscan.c']) sources = ['depends/python-iwscan/pyiwscan.c'])
setup(cmdclass={'configure' : configure, 'get_translations' : get_translations, setup(cmdclass={'configure' : configure, 'get_translations' : get_translations,
'uninstall' : uninstall, 'test' : test, 'cleargenerated' : cleargenerated}, 'uninstall' : uninstall, 'test' : test, 'clear_generated' : clear_generated},
name="Wicd", name="Wicd",
version=VERSION_NUM, version=VERSION_NUM,
description="A wireless and wired network manager", description="A wireless and wired network manager",