comparison mxtool/mx.py @ 14781:d2038d372cd2

changed distribution dependency exclusion mechanism to be only for library dependencies
author Doug Simon <doug.simon@oracle.com>
date Thu, 27 Mar 2014 12:45:11 +0100
parents 40aa1eb176db
children 66ac13a2c7a1
comparison
equal deleted inserted replaced
14780:aaecb0ca0c7d 14781:d2038d372cd2
59 59
60 """ 60 """
61 A distribution is a jar or zip file containing the output from one or more Java projects. 61 A distribution is a jar or zip file containing the output from one or more Java projects.
62 """ 62 """
63 class Distribution: 63 class Distribution:
64 def __init__(self, suite, name, path, deps, exclDeps): 64 def __init__(self, suite, name, path, deps, excludedLibs):
65 self.suite = suite 65 self.suite = suite
66 self.name = name 66 self.name = name
67 self.path = path.replace('/', os.sep) 67 self.path = path.replace('/', os.sep)
68 if not isabs(self.path): 68 if not isabs(self.path):
69 self.path = join(suite.dir, self.path) 69 self.path = join(suite.dir, self.path)
70 self.deps = deps 70 self.deps = deps
71 self.update_listeners = set() 71 self.update_listeners = set()
72 self.exclDeps = exclDeps 72 self.excludedLibs = excludedLibs
73 73
74 def sorted_deps(self, includeLibs=False): 74 def sorted_deps(self, includeLibs=False):
75 excl = [dependency(d) for d in self.exclDeps] 75 try:
76 excl = [library(d) for d in self.excludedLibs]
77 except SystemExit as e:
78 abort('invalid excluded library for {} distribution: {}'.format(self.name, e))
76 return [d for d in sorted_deps(self.deps, includeLibs=includeLibs) if d not in excl] 79 return [d for d in sorted_deps(self.deps, includeLibs=includeLibs) if d not in excl]
77 80
78 def __str__(self): 81 def __str__(self):
79 return self.name 82 return self.name
80 83
617 self.libs.append(l) 620 self.libs.append(l)
618 621
619 for name, attrs in distsMap.iteritems(): 622 for name, attrs in distsMap.iteritems():
620 path = attrs.pop('path') 623 path = attrs.pop('path')
621 deps = pop_list(attrs, 'dependencies') 624 deps = pop_list(attrs, 'dependencies')
622 exclDeps = pop_list(attrs, 'excludeDependencies') 625 exclLibs = pop_list(attrs, 'excludeLibs')
623 d = Distribution(self, name, path, deps, exclDeps) 626 d = Distribution(self, name, path, deps, exclLibs)
624 d.__dict__.update(attrs) 627 d.__dict__.update(attrs)
625 self.dists.append(d) 628 self.dists.append(d)
626 629
627 if self.name is None: 630 if self.name is None:
628 abort('Missing "suite=<name>" in ' + projectsFile) 631 abort('Missing "suite=<name>" in ' + projectsFile)
912 Gets the library for a given name. This will abort if the named library does 915 Gets the library for a given name. This will abort if the named library does
913 not exist and 'fatalIfMissing' is true. 916 not exist and 'fatalIfMissing' is true.
914 """ 917 """
915 l = _libs.get(name) 918 l = _libs.get(name)
916 if l is None and fatalIfMissing: 919 if l is None and fatalIfMissing:
920 if _projects.get(name):
921 abort(name + ' is a project, not a library')
917 abort('library named ' + name + ' not found') 922 abort('library named ' + name + ' not found')
918 return l 923 return l
919 924
920 def _as_classpath(deps, resolve): 925 def _as_classpath(deps, resolve):
921 cp = [] 926 cp = []
1529 if get_os() == 'windows': 1534 if get_os() == 'windows':
1530 log("mx: implement me! want to send SIGQUIT to my child process") 1535 log("mx: implement me! want to send SIGQUIT to my child process")
1531 else: 1536 else:
1532 _kill_process_group(p.pid, sig=signal.SIGQUIT) 1537 _kill_process_group(p.pid, sig=signal.SIGQUIT)
1533 time.sleep(0.1) 1538 time.sleep(0.1)
1539
1534 1540
1535 def abort(codeOrMessage): 1541 def abort(codeOrMessage):
1536 """ 1542 """
1537 Aborts the program with a SystemExit exception. 1543 Aborts the program with a SystemExit exception.
1538 If 'codeOrMessage' is a plain integer, it specifies the system exit status; 1544 If 'codeOrMessage' is a plain integer, it specifies the system exit status;