Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-07-13 23:45:46 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-07-13 23:45:46 (GMT)
commit6b76d7adc5e5493eb1df206915f54838986ca99a (patch)
tree0ad2d1e32be6d6ce310950abc4ee0cbedc8d68b3
parent3eea572ed3b44cac9a4f7dbb695d8cbba1fd30fd (diff)
Support packages that generates .pot files using sweets command
-rw-r--r--potupdater/pogenerator.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/potupdater/pogenerator.py b/potupdater/pogenerator.py
index a0d6bb6..413f0cc 100644
--- a/potupdater/pogenerator.py
+++ b/potupdater/pogenerator.py
@@ -265,17 +265,25 @@ class PotFile:
if retcode:
print 'ERROR - intltool failed with return code %i.' % retcode
+ elif self.method == 'sweets':
+ podir = os.path.dirname(self.location)
+ args = ['sweets', 'genpot', podir]
+ retcode = subprocess.call(args)
+ if retcode:
+ print 'ERROR - sweets failed with return code %i.' % retcode
+
# Now we do a diff
podir = os.path.dirname(self.location)
new_pot_file = os.path.join(podir, 'new.pot')
- if not exists(self.location):
- print ('\n\n ***** Create POT for ' + self.project + '*****\n\n\n')
- shutil.move(new_pot_file, self.location)
- elif len(diff(self.location, new_pot_file)):
- print ('\n\n ***** Updating POT for ' + self.project + '*****\n\n\n')
- shutil.move(new_pot_file, self.location)
- else:
- os.unlink(new_pot_file)
+ if exists(new_pot_file):
+ if not exists(self.location):
+ print ('\n\n ***** Create POT for ' + self.project + '*****\n\n\n')
+ shutil.move(new_pot_file, self.location)
+ elif len(diff(self.location, new_pot_file)):
+ print ('\n\n ***** Updating POT for ' + self.project + '*****\n\n\n')
+ shutil.move(new_pot_file, self.location)
+ else:
+ os.unlink(new_pot_file)
filename = self.location.split(os.sep)[-3]
project = self.location.split(os.sep)[-4]