Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

fix bugs in Syntax.py #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions client/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def Help(bin_name, subcommand=None):
"\t--jobs=num\t\t: Set the number of build threads",
False)
Log.colorprint("DEFAULT", "\t --all-log\t\t: Show all build log infomation", False)
Log.colorprint("DEFAULT", "\t --auto-includet\t: Add include directory of dependent modules", False)
Log.colorprint("DEFAULT", "\t --auto-lib\t\t: Add static library files of dependent modules", False)
return 0

if subcommand == "show-deps":
Expand Down Expand Up @@ -104,12 +106,16 @@ def OptionBuild(argv):
options["mode"] : debug or release
options["path"] : modular path
options["jobs"] : the number of build threads
options["auto_include"] : add directory include of dependent modules automatically
options["auto_lib"] : add .a files of dependent modules automatically
"""
options = dict()
options["all_log"] = False
options["path"] = ""
options["mode"] = "debug"
options["jobs"] = 4
options["auto_include"] = False
options["auto_lib"] = False

try:
opts, args = getopt.gnu_getopt(argv, "", ["all-log", "mode=", "jobs="])
Expand Down Expand Up @@ -140,6 +146,12 @@ def OptionBuild(argv):
if opt == "--jobs":
options["jobs"] = int(arg)
continue
if opt == "--auto-inlcude":
options["auto_include"] = True
continue
if opt == "--auto-lib":
options["auto_lib"] = True
continue
return None

return options
Expand Down
6 changes: 6 additions & 0 deletions dependency/Environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def BuildMode(self):
"""
return self._build_mode

def IsMain(self):
"""
whether is env object of main module
"""
return self._module.is_main

def AddSubDir(self, v):
"""
Add subdirectory v
Expand Down
1 change: 0 additions & 1 deletion dependency/Planish.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
from dependency import BrocModule_pb2
from util import Function


class Planish(object):
"""
class for planishing dependent modules
Expand Down
15 changes: 8 additions & 7 deletions dependency/Syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,8 @@ def DIRECTORY(v):
child_broc_dir = os.path.abspath(os.path.join(env.ModulePath(), v))
if env.ModulePath() not in child_broc_dir:
raise BrocArgumentIllegalError("DIRECTORY(%s) is wrong: %s not in %s" % \
(child_broc_dir, env.ModulePath())

child_broc_file = os.path.join(parent.module.root_path, v, 'BROC')
(child_broc_dir, env.ModulePath()))
child_broc_file = os.path.join(env.Module().root_path, v, 'BROC')
if sys.argv[0] == 'PLANISH':
parent = sys.argv[1]
if not os.path.exists(child_broc_file):
Expand Down Expand Up @@ -917,6 +916,8 @@ def LoadBROC(self):
if not broc_file:
self._lack_broc.add(parent.module.origin_config)
continue
env = Environment.Environment(parent.module)
Environment.SetCurrent(env)
try:
execfile(broc_file)
except BaseException as err:
Expand Down Expand Up @@ -959,8 +960,8 @@ def _download_broc(self, node):
return abs path of BROC file if download success
return None if download failed
"""
broc_path = None
cmd = None
broc_path = ""
cmd = ""
# for svn
# Log.Log().LevPrint("MSG", 'download BROC %s' % node.module.url)
if node.module.repo_kind == BrocModule_pb2.Module.SVN:
Expand All @@ -975,8 +976,8 @@ def _download_broc(self, node):
broc_path = os.path.join(node.module.workspace, node.module.module_cvspath, 'BROC')
broc_dir = os.path.dirname(broc_path)
if not os.path.exists(broc_path):
cmd += "git clone %s %s &&" \
% ("%s.git" % node.module.url, "%s" % broc_dir)
#cmd += "git clone %s %s &&" % ("%s.git" % node.module.url, "%s" % broc_dir)
cmd += "git clone %s %s" % (node.module.url, broc_dir)

if node.module.br_name and node.module.br_name != 'master':
br_name = node.module.br_name
Expand Down
1 change: 1 addition & 0 deletions example/foo/BROC
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIGS("brocbuild/log@master@branch")
CONFIGS("brocbuild/function@master@branch")

CONFIGS("brocbuild/data@master@branch")

#show the debug mode and the release mode
CXXFLAGS("-Werror -O0", "-Wall -O2")

Expand Down
2 changes: 1 addition & 1 deletion unittest/test_BrocTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_singleton(self):
postfix[2],
logger)
tree = BrocTree.BrocTree()
tree.SetRoot(root)
tree.SetRoot(BrocTree.BrocNode(root, None, True))
tree1 = BrocTree.BrocTree()
tree2 = BrocTree.BrocTree()
self.assertEqual(tree.Id(), tree1.Id())
Expand Down