The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

macport_install.py in scripts

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git

Revisions

View the latest version of scripts/macport_install.py.
Create plugin interface for the rendering classes
1 #!/usr/bin/python 2 """ 3 Copyright (C) 2013 Johan Mattsson 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 """ 18 19 import os 20 import subprocess 21 import glob 22 from optparse import OptionParser 23 from run import run 24 25 def install (file, dir): 26 if dest == "": 27 f = prefix + dir + '/' 28 else: 29 f = dest + prefix + dir + '/' 30 31 s = file.rfind ('/') 32 if s > -1: 33 f += file[s + 1:] 34 else: 35 f += file 36 print ("install: " + file + " in " + ' ' + dest + prefix + dir + '/') 37 subprocess.check_call ('install -d ' + dest + prefix + dir, shell=True) 38 subprocess.check_call ('install ' + file + ' ' + dest + prefix + dir + '/', shell=True) 39 40 parser = OptionParser() 41 parser.add_option ("-p", "--prefix", dest="prefix", help="install prefix", metavar="PREFIX") 42 parser.add_option ("-d", "--dest", dest="dest", help="install to this directory", metavar="DEST") 43 parser.add_option ("-a", "--app", dest="app", help="install application launcher in this directory", metavar="APP") 44 45 (options, args) = parser.parse_args() 46 47 if not options.prefix: 48 options.prefix = "/opt/local" 49 50 if not options.dest: 51 options.dest = "" 52 53 if not options.app: 54 options.app = "/Applications" 55 56 prefix = options.prefix 57 dest = options.dest 58 59 install ('build/bin/birdfont', '/bin') 60 install ('build/bin/birdfont-export', '/bin') 61 install ('build/bin/libbirdfont.dylib', '/lib') 62 63 for file in os.listdir('./layout'): 64 install ('layout/' + file, '/share/birdfont/layout') 65 66 for file in os.listdir('./icons'): 67 install ('icons/' + file, '/share/birdfont/icons') 68 69 for lang_dir in glob.glob('build/locale/*'): 70 lc = lang_dir.replace ('build/locale/', "") 71 install ('build/locale/' + lc + '/LC_MESSAGES/birdfont.mo', '/share/locale/' + lc + '/LC_MESSAGES' ); 72 73 run ("cp -R -p build/BirdFont.app " + options.app) 74