mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
build.py: Make it somewhat functional
This commit is contained in:
parent
b5b3f79d5b
commit
ed3d466dd4
1 changed files with 20 additions and 8 deletions
|
|
@ -2,6 +2,7 @@
|
|||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
import dircache
|
||||
import linecache
|
||||
import fileinput
|
||||
|
|
@ -37,16 +38,15 @@ def build_tree(cur):
|
|||
dep_tree[cur] = deps
|
||||
return len(deps)
|
||||
|
||||
def create_bottom_up_order(cur):
|
||||
def calculate_order(cur):
|
||||
build_tree(cur)
|
||||
while len(all_deps):
|
||||
for d in all_deps:
|
||||
if not len(dep_tree[d]):
|
||||
break
|
||||
else:
|
||||
print "none of the following modules has no dependencies:"
|
||||
print all_deps
|
||||
return -1
|
||||
raise Exception("fatal: all of these modules have at least one unresolvable dependency")
|
||||
order.append(d)
|
||||
all_deps.remove(d)
|
||||
for k in dep_tree.keys():
|
||||
|
|
@ -54,9 +54,21 @@ def create_bottom_up_order(cur):
|
|||
dep_tree[k].remove(d)
|
||||
return 1
|
||||
|
||||
def build(cur):
|
||||
create_bottom_up_order(cur)
|
||||
def run_make(module, target):
|
||||
path = find_proj_path(module)
|
||||
print "========= running make " + target + " in " + path
|
||||
os.chdir(path)
|
||||
if subprocess.call(["make", target]):
|
||||
raise Exception("failed to make target " + target + " in module " + module)
|
||||
|
||||
def build(module, target):
|
||||
calculate_order(module)
|
||||
if target in ["clean", "distclean"]:
|
||||
for m in reversed(order):
|
||||
run_make(m, target)
|
||||
else:
|
||||
for m in order:
|
||||
run_make(m, target)
|
||||
|
||||
build(sys.argv[1], sys.argv[2])
|
||||
|
||||
build("jux2")
|
||||
print dep_tree
|
||||
print order
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue