[Debian-in-commits] [SCM] dh-make-font.git branch, vasudev, updated. cf7f4e0968a9a974be78a953681f2eecec0429a5
Vasudev Kamath
kamathvasudev at gmail.com
Mon Dec 19 06:49:01 UTC 2011
The following commit has been merged in the vasudev branch:
commit cf7f4e0968a9a974be78a953681f2eecec0429a5
Author: Vasudev Kamath <kamathvasudev at gmail.com>
Date: Mon Dec 19 12:17:52 2011 +0530
Added install and links file. Now dh-make-font is complete for version 1. Needs a lot of testing
diff --git a/dh-make-font b/dh-make-font
index 9af9bea..ecd6519 100755
--- a/dh-make-font
+++ b/dh-make-font
@@ -11,6 +11,7 @@ required_files = ["control", "copyright", "changelog", "source", "compat",
DEFAULT_MAINTAINER = "Debian Fonts Task Force <pkg-fonts-devel at lists.alioth.debian.org>"
UPLOADERS = (os.environ.get('DEBFULLNAME') + " " + os.environ.get('DEBEMAIL'))\
if os.environ.has_key('DEBEMAIL') else "#Please fill in your name and email"
+PACKAGE = ""
font_reg_exp = re.compile("((.)*\.ttf|sfd|otf)") # RE to check
@@ -69,11 +70,14 @@ def call_dh_make(args):
This function is a wrapper against the dh_make command
"""
+ global PACKAGE
+
args_string = " -createorig" # Stores the final argument to be passed to dh_make
if(args.copyright):
args_string += " -c "+args.copyright
if(args.package):
args_string += " -p "+args.package
+ PACKAGE = args.package.split('_')[0] if args.package.find('_') else args.package
else:
"""
If user has not supplied -p or --package option which should be passed to
@@ -94,11 +98,16 @@ def call_dh_make(args):
"""
if args.foldername.find('-'):
args.foldername = args.foldername.replace('-','_')
-
+
+ folder = ""
if not args.foldername.startswith('fonts-'):
args_string += " -p fonts-" + args.foldername
+ folder = 'fonts-'+args.foldername
else:
args_string += " -p " + args.foldername
+ folder = args.foldername
+
+ PACKAGE = folder.split('_')[0] if folder.find('_') else folder
# Make a call to the system function.
return os.system("dh_make"+args_string)
@@ -150,9 +159,36 @@ def update_control_file(args):
control_content += "\n"
with open('control','wb') as fd:
- fd.write(control_content)
-
+ fd.write(control_content)
+def create_install_and_links():
+ """
+ This function writes install file it checks for availabilty of
+ ttf or otf file and writes a proper install file also if a font
+ config .conf file is available creates a links file to do proper
+ linking
+ """
+ global PACKAGE
+ 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 + "/"
+ elif filename.endswith('.otf'):
+ install += "./"+filename + " usr/share/fonts/truetype/" + PACKAGE + "/"
+ elif filename.endswith('.conf'):
+ install += "./"+filename + " etc/fonts/conf.avail"
+ print "\nFound a fontconfig configuration file. Added it to debian/install"
+ with open('links','w') as fd:
+ 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)
+
def main():
"""
Main part of the script. Kept in seperate function to have a good
@@ -179,6 +215,7 @@ def main():
fd.write(watch)
update_control_file(args)
+ create_install_and_links()
if __name__ == "__main__":
main()
--
dh-make-font.git
More information about the Debian-in-commits
mailing list