[game-data-packager] 01/01: rework modify_control_template as there aren't templates anymore

Alexandre Detiste detiste-guest at moszumanska.debian.org
Wed May 11 09:40:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit 21c0adb7df092b2476b58cc3002591b13c2fb3dd
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Wed May 11 11:39:15 2016 +0200

    rework modify_control_template as there aren't templates anymore
---
 game_data_packager/build.py | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index 244a67b..4106f93 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -1475,16 +1475,10 @@ class PackagingTask(object):
                 outfile.write('%s  %s\n' % (package.md5sums[file], file))
         os.chmod(md5sums, 0o644)
 
-        try:
-            control_in = open(self.get_control_template(package),
-                    encoding='utf-8')
-            control = Deb822(control_in)
-        except FileNotFoundError:
-            control = Deb822()
-        self.modify_control_template(control, package, destdir)
-        control.dump(fd=open(os.path.join(debdir, 'control'), 'wb'),
-                encoding='utf-8')
-        os.chmod(os.path.join(debdir, 'control'), 0o644)
+        control = os.path.join(destdir, 'DEBIAN/control')
+        self.generate_control(package, destdir).dump(fd=open(control, 'wb'),
+                                                encoding='utf-8')
+        os.chmod(control, 0o644)
 
     def fill_dest_dir(self, package, destdir):
         if not self.check_complete(package, log=True):
@@ -1614,9 +1608,16 @@ class PackagingTask(object):
                     # make other files rw-r--r--
                     os.chmod(full, 0o644)
 
-    def modify_control_template(self, control, package, destdir):
-        for key in control.keys():
-            assert key == 'Description', 'specify "%s" only in YAML' % key
+    def generate_control(self, package, destdir):
+        try:
+            control_in = open(os.path.join(DATADIR,
+                              package.name + '.control.in'), encoding='utf-8')
+            control = Deb822(control_in)
+            for key in control.keys():
+                assert key == 'Description', 'specify "%s" only in YAML' % key
+        except FileNotFoundError:
+            control = Deb822()
+
         control['Package'] = package.name
         control['Version'] = package.version
         control['Priority'] = 'optional'
@@ -1730,6 +1731,8 @@ class PackagingTask(object):
             short_desc, long_desc = self.generate_description(package)
             control['Description'] = short_desc + '\n ' + long_desc.replace('\n', '\n ')
 
+        return control
+
     def generate_description(self, package):
         longname = package.longname or self.game.longname
 
@@ -1808,9 +1811,6 @@ class PackagingTask(object):
 
         return (short_desc, long_desc)
 
-    def get_control_template(self, package):
-        return os.path.join(DATADIR, package.name + '.control.in')
-
     def look_for_engines(self, packages, force=False):
         engines = set()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list