~ubuntu-branches/ubuntu/wily/scribus/wily-proposed

« back to all changes in this revision

Viewing changes to OSX-package/linktools/mkframework.py

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import os
 
4
import sys
 
5
import shutil
 
6
import osxtools
 
7
 
 
8
def usage():
 
9
        print """
 
10
 Usage: mkframework.py bundle [-l libfile] [-v version]
 
11
 
 
12
        Creates the directory structure for a framework.
 
13
        If libfile is given, it will be used as the frameworks executable,
 
14
        otherwise the framework will just be an empty shell.
 
15
                
 
16
        bundle: the path to the *.framework bundle
 
17
        -l lib: copy lib into the bundle. 
 
18
        -v ver: use "ver" as the version instead of the standard 'A'
 
19
        -f:     overwrite existing files if version exists
 
20
        """
 
21
 
 
22
 
 
23
if len(sys.argv) <= 1 or sys.argv[1] == "-?" :
 
24
        usage()
 
25
        sys.exit(0)
 
26
 
 
27
 
 
28
 
 
29
version = "A"
 
30
overwrite = False
 
31
libfile = None
 
32
bundle = None
 
33
 
 
34
argp = 1
 
35
 
 
36
while argp < len(sys.argv) :
 
37
        if sys.argv[argp] == '-f':
 
38
                overwrite = True;
 
39
                argp = argp + 1
 
40
        elif sys.argv[argp] == '-l' :
 
41
                libfile = (sys.argv[argp + 1])
 
42
                argp = argp + 2
 
43
        elif sys.argv[argp][0:2] == '-l' :
 
44
                libfile = (sys.argv[argp][2:])
 
45
                argp = argp + 1
 
46
        elif sys.argv[argp] == '-v' :
 
47
                version = (sys.argv[argp + 1])
 
48
                argp = argp + 2
 
49
        elif sys.argv[argp][0:2] == '-v' :
 
50
                version = (sys.argv[argp][2:])
 
51
                argp = argp + 1
 
52
        elif  sys.argv[argp][0:1] == '-' :
 
53
                print "Error: unknown option: " + sys.argv[argp]
 
54
                usage()
 
55
                sys.exit(1)
 
56
        elif bundle == None:
 
57
                bundle = sys.argv[argp]
 
58
                argp = argp + 1
 
59
        else:
 
60
                print "Error: more than one bundle path specified!"
 
61
                usage()
 
62
                sys.exit(1)
 
63
 
 
64
if bundle == None:      
 
65
        print "Error: no bundle path specified!"
 
66
        usage()
 
67
        sys.exit(1)
 
68
 
 
69
if not os.path.isabs(bundle):
 
70
        bundle = os.path.join(os.getenv("PWD"), bundle)
 
71
        
 
72
if bundle[-10 : ] != ".framework":
 
73
        bundle = bundle + ".framework"
 
74
fwName = os.path.basename(bundle)[0: -10]
 
75
        
 
76
if not os.path.exists(bundle):
 
77
        os.makedirs(bundle, 0755)
 
78
elif not os.path.isdir(bundle):
 
79
        print "Error: '" + bundle + "' is no bundle path!"
 
80
        usage()
 
81
        sys.exit(1)
 
82
 
 
83
versionPath = os.path.join(bundle, "Versions", version)
 
84
 
 
85
if os.path.exists(versionPath):
 
86
        if overwrite:
 
87
                shutil.removetree(versionPath)
 
88
        else:
 
89
                print "Error: '" + versionPath + "' already exists!"
 
90
                usage()
 
91
                sys.exit(1)
 
92
 
 
93
os.makedirs(versionPath, 0755)
 
94
 
 
95
if libfile != None:
 
96
        shutil.copy(libfile, os.path.join(versionPath, fwName))
 
97
        os.system("install_name_tool -id @executable_path/" + 
 
98
                                os.path.join("../Frameworks",
 
99
                                                        fwName + ".framework",
 
100
                                                        "Versions",
 
101
                                                        version,
 
102
                                                        fwName) +
 
103
                                " " +
 
104
                                os.path.join(versionPath, fwName))
 
105
                        
 
106
osxtools.createSymlinks(bundle, [
 
107
        ("Versions/Current", version),
 
108
        (fwName, os.path.join("Versions/Current", fwName)),
 
109
        ("Headers", "Versions/Current/Headers")
 
110
])
 
111