comparison mxtool/mx.py @ 15638:83c69954bbaa

mxtool: distribution dependency should be a list
author Bernhard Urban <bernhard.urban@jku.at>
date Wed, 14 May 2014 11:19:38 +0200
parents 4aeb0b80324f
children 50fbda571d99
comparison
equal deleted inserted replaced
15637:40f13c935d8b 15638:83c69954bbaa
60 60
61 """ 61 """
62 A distribution is a jar or zip file containing the output from one or more Java projects. 62 A distribution is a jar or zip file containing the output from one or more Java projects.
63 """ 63 """
64 class Distribution: 64 class Distribution:
65 def __init__(self, suite, name, path, sourcesPath, deps, excludedDependencies, distDependency): 65 def __init__(self, suite, name, path, sourcesPath, deps, excludedDependencies, distDependencies):
66 self.suite = suite 66 self.suite = suite
67 self.name = name 67 self.name = name
68 self.path = path.replace('/', os.sep) 68 self.path = path.replace('/', os.sep)
69 self.path = _make_absolute(self.path, suite.dir) 69 self.path = _make_absolute(self.path, suite.dir)
70 self.sourcesPath = _make_absolute(sourcesPath.replace('/', os.sep), suite.dir) if sourcesPath else None 70 self.sourcesPath = _make_absolute(sourcesPath.replace('/', os.sep), suite.dir) if sourcesPath else None
71 self.deps = deps 71 self.deps = deps
72 self.update_listeners = set() 72 self.update_listeners = set()
73 self.excludedDependencies = excludedDependencies 73 self.excludedDependencies = excludedDependencies
74 self.distDependency = distDependency 74 self.distDependencies = distDependencies
75 75
76 def sorted_deps(self, includeLibs=False): 76 def sorted_deps(self, includeLibs=False):
77 try: 77 try:
78 excl = [dependency(d) for d in self.excludedDependencies] 78 excl = [dependency(d) for d in self.excludedDependencies]
79 except SystemExit as e: 79 except SystemExit as e:
124 overwriteCheck(srcArc.zf, arcname, lpath + '!' + arcname) 124 overwriteCheck(srcArc.zf, arcname, lpath + '!' + arcname)
125 srcArc.zf.writestr(arcname, lp.read(arcname)) 125 srcArc.zf.writestr(arcname, lp.read(arcname))
126 else: 126 else:
127 p = dep 127 p = dep
128 128
129 if self.distDependency and p in _dists[self.distDependency].sorted_deps(): 129 isCoveredByDependecy = False
130 logv("Excluding {0} from {1} because it's provided by the dependency {2}".format(p.name, self.path, self.distDependency)) 130 for d in self.distDependencies:
131 if p in _dists[d].sorted_deps():
132 logv("Excluding {0} from {1} because it's provided by the dependency {2}".format(p.name, self.path, d))
133 isCoveredByDependecy = True
134 break
135
136 if isCoveredByDependecy:
131 continue 137 continue
132 138
133 # skip a Java project if its Java compliance level is "higher" than the configured JDK 139 # skip a Java project if its Java compliance level is "higher" than the configured JDK
134 jdk = java(p.javaCompliance) 140 jdk = java(p.javaCompliance)
135 if not jdk: 141 if not jdk:
753 for name, attrs in distsMap.iteritems(): 759 for name, attrs in distsMap.iteritems():
754 path = attrs.pop('path') 760 path = attrs.pop('path')
755 sourcesPath = attrs.pop('sourcesPath', None) 761 sourcesPath = attrs.pop('sourcesPath', None)
756 deps = pop_list(attrs, 'dependencies') 762 deps = pop_list(attrs, 'dependencies')
757 exclDeps = pop_list(attrs, 'exclude') 763 exclDeps = pop_list(attrs, 'exclude')
758 distDep = attrs.pop('distDependency', None) 764 distDeps = pop_list(attrs, 'distDependencies')
759 d = Distribution(self, name, path, sourcesPath, deps, exclDeps, distDep) 765 d = Distribution(self, name, path, sourcesPath, deps, exclDeps, distDeps)
760 d.__dict__.update(attrs) 766 d.__dict__.update(attrs)
761 self.dists.append(d) 767 self.dists.append(d)
762 768
763 if self.name is None: 769 if self.name is None:
764 abort('Missing "suite=<name>" in ' + projectsFile) 770 abort('Missing "suite=<name>" in ' + projectsFile)