Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] big reorg of the bundle builder
Moved a lot of code into proper classes and modules, redesigned the package format to just be proper python classes that extend or instantiate the new base Package class which does all the build work. Everything is much simpler and more extensible now.
- Loading branch information
Showing
59 changed files
with
884 additions
and
858 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
import os | |||
from unixprofile import UnixProfile | |||
|
|||
class DarwinProfile (UnixProfile): | |||
def __init__ (self): | |||
UnixProfile.__init__ (self) | |||
|
|||
self.name = 'darwin' | |||
self.mac_sdk_path = '/Developer/SDKs/MacOSX10.5.sdk' | |||
|
|||
if not os.path.isdir (self.mac_sdk_path): | |||
raise IOError ('Mac OS X SDK does not exist: %s' \ | |||
% self.mac_sdk_path) | |||
|
|||
self.gcc_flags.extend ([ | |||
'-D_XOPEN_SOURCE', | |||
'-isysroot %{mac_sdk_path}', | |||
'-mmacosx-version-min=10.5' | |||
]) | |||
|
|||
self.env.set ('CC', 'gcc-4.2') | |||
self.env.set ('CXX', 'g++-4.2') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
import os | |||
from util import * | |||
from collections import deque | |||
|
|||
class EnvironmentItem: | |||
def __init__ (self, name, joinchar, values): | |||
self.name = name | |||
self.joinchar = joinchar | |||
self.values = values | |||
|
|||
def __str__ (self): | |||
return self.joinchar.join (self.values) | |||
|
|||
class Environment: | |||
def __init__ (self, profile): | |||
self._profile = profile | |||
|
|||
def set (self, *argv): | |||
args = deque (argv) | |||
name = args.popleft () | |||
joinchar = args.popleft () | |||
if len (args) == 0: | |||
values = list (self.iter_flatten (joinchar)) | |||
joinchar = '' | |||
else: | |||
values = list (self.iter_flatten (list (args))) | |||
|
|||
self.__dict__[name] = EnvironmentItem (name, joinchar, values) | |||
return self.__dict__[name] | |||
|
|||
def compile (self): | |||
expand_macros (self, self._profile) | |||
|
|||
def dump (self): | |||
for k in self.get_names (): | |||
print 'export %s="%s"' % (k, self.__dict__[k]) | |||
|
|||
def export (self): | |||
for k in self.get_names (): | |||
os.environ[k] = str (self.__dict__[k]) | |||
|
|||
def get_names (self): | |||
for k in self.__dict__.keys (): | |||
if not k.startswith ('_'): | |||
yield k | |||
|
|||
def iter_flatten (self, iterable): | |||
if not isinstance (iterable, (list, tuple)): | |||
yield iterable | |||
return | |||
it = iter (iterable) | |||
for e in it: | |||
if isinstance (e, (list, tuple)): | |||
for f in self.iter_flatten (e): | |||
yield f | |||
else: | |||
yield e | |||
|
Oops, something went wrong.