aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-30 14:06:59 -0500
committerGitHub <noreply@github.com>2017-05-30 14:06:59 -0500
commit011a7adf56d9a58be9707cdeeeb824c4b70df84a (patch)
tree4d6b096306ac99009d0521de752fff59570bfec2 /python
parentdd0813b3f2dfe39963d4e82a241aca8ec19f099c (diff)
parent45c499d011f911b127f771b5743f1b5cfcba40ef (diff)
downloadservo-011a7adf56d9a58be9707cdeeeb824c4b70df84a.tar.gz
servo-011a7adf56d9a58be9707cdeeeb824c4b70df84a.zip
Auto merge of #17085 - aneeshusa:fix-mach-upload-nightly-for-macbrew, r=larsbergstrom
Fix `./mach upload-nightly macbrew` <!-- Please describe your changes on the following line: --> Fix a few issues with the Homebrew repository updating. Follow-up to #16565; should finish off #17045. Lightly smoke-tested locally this time. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they will be tested on the builders <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17085) <!-- Reviewable:end -->
Diffstat (limited to 'python')
-rw-r--r--python/servo/package_commands.py26
-rw-r--r--python/servo/servo-binary-formula.rb.in21
2 files changed, 44 insertions, 3 deletions
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py
index 57294f00763..67da3f83d5c 100644
--- a/python/servo/package_commands.py
+++ b/python/servo/package_commands.py
@@ -59,6 +59,24 @@ PACKAGES = {
}
+TemporaryDirectory = None
+if sys.version_info >= (3, 2):
+ TemporaryDirectory = tempfile.TemporaryDirectory
+else:
+ import contextlib
+
+ # Not quite as robust as tempfile.TemporaryDirectory,
+ # but good enough for most purposes
+ @contextlib.contextmanager
+ def TemporaryDirectory(**kwargs):
+ dir_name = tempfile.mkdtemp(**kwargs)
+ try:
+ yield dir_name
+ except Exception as e:
+ shutil.rmtree(dir_name)
+ raise e
+
+
def otool(s):
o = subprocess.Popen(['/usr/bin/otool', '-L', s], stdout=subprocess.PIPE)
for l in o.stdout:
@@ -442,7 +460,7 @@ class PackageCommands(CommandBase):
brew_version = timestamp.strftime('%Y.%m.%d')
- with tempfile.TemporaryDirectory(prefix='homebrew-servo') as tmp_dir:
+ with TemporaryDirectory(prefix='homebrew-servo') as tmp_dir:
def call_git(cmd, **kwargs):
subprocess.check_call(
['git', '-C', tmp_dir] + cmd,
@@ -461,7 +479,7 @@ class PackageCommands(CommandBase):
formula = formula.replace('PACKAGEURL', package_url)
formula = formula.replace('SHA', digest)
formula = formula.replace('VERSION', brew_version)
- with open(path.join(tmp_dir, 'Formula', 'servo-bin.rb')) as f:
+ with open(path.join(tmp_dir, 'Formula', 'servo-bin.rb'), 'w') as f:
f.write(formula)
call_git(['add', path.join('.', 'Formula', 'servo-bin.rb')])
@@ -491,6 +509,8 @@ class PackageCommands(CommandBase):
upload_to_s3(platform, package, timestamp)
if platform == 'macbrew':
- update_brew(package, timestamp)
+ packages = PACKAGES[platform]
+ assert(len(packages) == 1)
+ update_brew(packages[0], timestamp)
return 0
diff --git a/python/servo/servo-binary-formula.rb.in b/python/servo/servo-binary-formula.rb.in
new file mode 100644
index 00000000000..fad773f93ab
--- /dev/null
+++ b/python/servo/servo-binary-formula.rb.in
@@ -0,0 +1,21 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+class ServoBin < Formula
+ desc "Servo, the Parallel Browser Engine Project (binary version)"
+ homepage "http://servo.org"
+ url "PACKAGEURL"
+ version "VERSION"
+ sha256 "SHA"
+
+ bottle :unneeded
+
+ def install
+ prefix.install "bin", "libexec", "resources"
+ end
+
+ test do
+ system bin/"servo", "-o", "/dev/null", "-x", "http://example.com"
+ end
+end