comparison enterprise/kdepim.py @ 111:7f6fb8103db0

Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py This creates a new function treepkg.util.replace_in_file with some tests in test/test_util.py and new test support code in test/filesupport.py. Also, adapt enterprise/kdepim.py to use the new function.
author Bernhard Herzog <bh@intevation.de>
date Wed, 19 Mar 2008 19:50:32 +0000
parents 78cf5f6778ec
children
comparison
equal deleted inserted replaced
110:ba677506e95e 111:7f6fb8103db0
1 # Copyright (C) 2007 by Intevation GmbH 1 # Copyright (C) 2007, 2008 by Intevation GmbH
2 # Authors: 2 # Authors:
3 # Bernhard Herzog <bh@intevation.de> 3 # Bernhard Herzog <bh@intevation.de>
4 # 4 #
5 # This program is free software under the GPL (>=v2) 5 # This program is free software under the GPL (>=v2)
6 # Read the file COPYING coming with the software for details. 6 # Read the file COPYING coming with the software for details.
42 """Overrides the inherited method to update version numbers in the code 42 """Overrides the inherited method to update version numbers in the code
43 """ 43 """
44 versionstring = "(enterprise %s)" % self.enterprise_version 44 versionstring = "(enterprise %s)" % self.enterprise_version
45 for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp", 45 for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp",
46 "korganizer/version.h"]: 46 "korganizer/version.h"]:
47 filename = os.path.join(pkgbasedir, versionfile) 47 treepkg.util.replace_in_file(os.path.join(pkgbasedir, versionfile),
48 patched = re.sub("\(enterprise ([^)]*)\)", versionstring, 48 "\(enterprise ([^)]*)\)",
49 open(filename).read()) 49 versionstring)
50 f = open(filename, "w")
51 f.write(patched)
52 f.close()
53 50
54 def do_package(self): 51 def do_package(self):
55 pkgbaseversion, pkgbasedir = self.export_sources() 52 pkgbaseversion, pkgbasedir = self.export_sources()
56 self.update_version_numbers(pkgbasedir) 53 self.update_version_numbers(pkgbasedir)
57 54
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)