servo: Merge #17103 - Shim subprocess.DEVNULL for Python 2 (from aneeshusa:shim-subprocess-devnull); r=larsbergstrom
authorAneesh Agrawal <aneeshusa@gmail.com>
Tue, 30 May 2017 19:06:45 -0500
changeset 409542 501a1089d16723c1a9945e17a3d786b41de1415f
parent 409541 c25cbb6d95e8e31afe7427de7ac580a7b1776cc6
child 409543 47660663c12f2851cfbe6a2f2da4bf915ff0afac
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslarsbergstrom
bugs17103, 17045
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17103 - Shim subprocess.DEVNULL for Python 2 (from aneeshusa:shim-subprocess-devnull); r=larsbergstrom This was introduced in Python 3.3, so provide our own version. Requires careful review since this will leak secrets (!!!) if not done properly. <!-- Please describe your changes on the following line: --> --- <!-- 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 - [x] These changes help with #17045 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because must be tested manually <!-- 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. --> Source-Repo: https://github.com/servo/servo Source-Revision: 71a4daec510d79f49245981e0c379167812a9c0a
servo/python/servo/package_commands.py
--- a/servo/python/servo/package_commands.py
+++ b/servo/python/servo/package_commands.py
@@ -485,23 +485,25 @@ class PackageCommands(CommandBase):
                 call_git(['add', path.join('.', 'Formula', 'servo-bin.rb')])
                 call_git([
                     '-c', 'user.name=Tom Servo',
                     '-c', 'user.email=servo@servo.org',
                     'commit',
                     '--message=Version Bump: {}'.format(brew_version),
                 ])
 
-                token = os.environ['GITHUB_HOMEBREW_TOKEN']
-                call_git([
-                    'push',
-                    '-qf',
-                    'https://{}@github.com/servo/homebrew-servo.git'.format(token),
-                    'master',
-                ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+                push_url = 'https://{}@github.com/servo/homebrew-servo.git'
+                # TODO(aneeshusa): Use subprocess.DEVNULL with Python 3.3+
+                with open(os.devnull, 'wb') as DEVNULL:
+                    call_git([
+                        'push',
+                        '-qf',
+                        push_url.format(os.environ['GITHUB_HOMEBREW_TOKEN']),
+                        'master',
+                    ], stdout=DEVNULL, stderr=DEVNULL)
 
         timestamp = datetime.utcnow().replace(microsecond=0)
         for package in PACKAGES[platform]:
             if not path.isfile(package):
                 print("Could not find package for {} at {}".format(
                     platform,
                     package
                 ), file=sys.stderr)