Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make NativeTARDistribution usable #87

Merged
merged 4 commits into from
Mar 17, 2016
Merged
Changes from 1 commit
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
16 changes: 13 additions & 3 deletions mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,10 +1096,11 @@ def cleanForbidden(self):
path: suite-local path to where the tar file will be placed
"""
class NativeTARDistribution(Distribution):
def __init__(self, suite, name, deps, path, excludedLibs, platformDependent, theLicense, relpath):
def __init__(self, suite, name, deps, path, excludedLibs, platformDependent, theLicense, relpath, output):
Distribution.__init__(self, suite, name, deps, excludedLibs, platformDependent, theLicense)
self.path = _make_absolute(path, suite.dir)
self.relpath = relpath
self.output = output

def make_archive(self):
directory = dirname(self.path)
Expand Down Expand Up @@ -1140,9 +1141,17 @@ def localExtension(self):
def postPull(self, f):
assert f.endswith('.gz')
logv('Uncompressing {}...'.format(f))
tarfilename = None
with gzip.open(f, 'rb') as gz, open(f[:-len('.gz')], 'wb') as tar:
shutil.copyfileobj(gz, tar)
tarfilename = tar.name
os.remove(f)
if self.output:
output = join(self.suite.dir, self.output)
assert tarfilename
with tarfile.open(tarfilename, 'r:') as tar:
log('Extract {} to {}'.format(tarfilename, output))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe s/Extract/Extracting/?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

tar.extractall(output)

def prePush(self, f):
tgz = f + '.gz'
Expand Down Expand Up @@ -5311,7 +5320,8 @@ def _load_distribution(self, name, attrs):
if native:
path = attrs.pop('path')
relpath = attrs.pop('relpath', False)
d = NativeTARDistribution(self, name, deps, path, exclLibs, platformDependent, theLicense, relpath)
output = attrs.pop('output', None)
d = NativeTARDistribution(self, name, deps, path, exclLibs, platformDependent, theLicense, relpath, output)
else:
defaultPath = join(self.get_output_root(), 'dists', _map_to_maven_dist_name(name) + '.jar')
defaultSourcesPath = join(self.get_output_root(), 'dists', _map_to_maven_dist_name(name) + '.src.zip')
Expand Down Expand Up @@ -12884,7 +12894,7 @@ def alarm_handler(signum, frame):
# no need to show the stack trace when the user presses CTRL-C
abort(1)

version = VersionSpec("5.14.1")
version = VersionSpec("5.14.2")

currentUmask = None

Expand Down