[Debian-in-commits] [SCM] dh-make-font.git branch, master, updated. 4e56f01a03c1955035278fd4be6315f50d8644b7
Vasudev Kamath
kamathvasudev at gmail.com
Mon Jul 16 17:02:56 UTC 2012
The following commit has been merged in the master branch:
commit 4e56f01a03c1955035278fd4be6315f50d8644b7
Author: Vasudev Kamath <kamathvasudev at gmail.com>
Date: Sun Jul 15 21:58:30 2012 +0530
Added feature to handle when sfd files are involved and the font is supposed to be built from source
diff --git a/dh-make-font b/dh-make-font
index 42c40ff..d1e24b9 100755
--- a/dh-make-font
+++ b/dh-make-font
@@ -15,8 +15,13 @@ PACKAGE = ""
font_reg_exp = re.compile("((.)*\.ttf|sfd|otf)") # RE to check
font_sfd_regx = re.compile("((.)*\.sfd)") # RE to check font source file
+generate_function = re.compile("Generate\(.*\)")
+
font_source=False
+GENERATES_TTF = False
+GENERATES_OTF = False
+
watch = """
version=3
#please put upstream url for watch expression
@@ -186,6 +191,21 @@ def update_control_file(args):
with open('control','wb') as fd:
fd.write(control_content)
+def check_generatepe(filepath):
+ global GENERATES_TTF, GENERATES_OTF
+ with open(filepath) as fd:
+ content = fd.read()
+ if generate_function.search(content):
+ # We did find Generate function
+ for function in generate_function.findall(content):
+ if function.find('.ttf') != -1:
+ GENERATES_TTF = True
+ break
+ elif function.find('.otf') != -1:
+ GENERATES_OTF = True
+ break
+
+
def create_install_and_links():
"""
This function writes install file it checks for availabilty of
@@ -194,14 +214,27 @@ def create_install_and_links():
linking
"""
global PACKAGE
+ install_dir = PACKAGE.split('fonts-')[1]
install = ""
for dirpath,dirnames,filenames in os.walk('..'):
if dirnames != 'debian':
for filename in filenames:
if filename.endswith('.ttf'):
- install += "./"+filename + " usr/share/fonts/truetype/" + PACKAGE + "/"
+ install += "./"+filename + " usr/share/fonts/truetype/" + install_dir + "/\n"
elif filename.endswith('.otf'):
- install += "./"+filename + " usr/share/fonts/truetype/" + PACKAGE + "/"
+ install += "./"+filename + " usr/share/fonts/truetype/" + install_dir + "/\n"
+ elif filename.endswith('.sfd'):
+ if 'generate.pe' in filenames:
+ check_generatepe(os.path.join(dirpath,filenames[filenames.index('generate.pe')]))
+ if GENERATES_TTF:
+ install += "./"+filename.replace('sfd','ttf') + " usr/share/fonts/truetype/" + install_dir + "/\n"
+ elif GENERATES_OTF:
+ install += "./"+filename.replace('sfd','otf') + " usr/share/fonts/opentype/" + install_dir + "/\n"
+ else:
+ print "\n*Unable to determine if source generates TTF or OTF file. Please manually edit the debian/install file*"
+ else:
+ print "\n*Unable to determine if source generates TTF or OTF file. Please manually edit the debian/install file*"
+
elif filename.endswith('.conf'):
install += "./"+filename + " etc/fonts/conf.avail"
print "\nFound a fontconfig configuration file. Added it to debian/install"
@@ -209,8 +242,6 @@ def create_install_and_links():
fd.write('etc/fonts/conf.avail/'+filename + ' etc/fonts/conf.d/'+filename)
print "\nI've symlinked conf file in etc/fonts/conf.d. Please update fontconfig priority appropriately"
- # TODO: What to do when sfd?
- install += "\n"
with open('install','w') as fd:
fd.write(install)
@@ -225,7 +256,9 @@ def print_todo():
3. Please add DEP5 format URI in debian/copyright
4. Please add fonts copyright in debian/copyright
5. Check debian/install and debian/links if they exist
- 6. Build the package and enjoy!
+ 6. If font is built from source make sure font name and install target is
+ proper in debian/install
+ 7. Build the package and enjoy!
""")
def main():
--
dh-make-font.git
More information about the Debian-in-commits
mailing list