Repository: mesos
Updated Branches:
  refs/heads/master a6f52defb -> 14c68199c


Added virtualenv requirements watcher to Python 3 mesos-style.py.

The Python and JavaScript linters run by mesos-style.py, called
by our Git hooks, require a virtual environment. This virtual
environment needs to be rebuilt by running `build-virtualenv`
each time the pip dependencies of our Python codebase are
updated.

The check `should_build_virtualenv` had not been added to the Python 3
`mesos-style.py` for an unknown reason and this is now fixed.

We pass the Python interpreter used to run `mesos-style.py` when running
`build-virtualenv` in case Python 3 is used to run `mesos-style.py`
but Python 2 is still the default `python`.

Review: https://reviews.apache.org/r/67855/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1cc7054d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1cc7054d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1cc7054d

Branch: refs/heads/master
Commit: 1cc7054d1ae9b6180013353ddb7d5427f01c7cb2
Parents: a6f52de
Author: Armand Grillet <agril...@mesosphere.io>
Authored: Wed Jul 11 12:21:54 2018 +0200
Committer: Benjamin Bannier <bbann...@apache.org>
Committed: Wed Jul 11 12:21:54 2018 +0200

----------------------------------------------------------------------
 support/python3/mesos-style.py | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1cc7054d/support/python3/mesos-style.py
----------------------------------------------------------------------
diff --git a/support/python3/mesos-style.py b/support/python3/mesos-style.py
index 0a4b1b1..350ef90 100755
--- a/support/python3/mesos-style.py
+++ b/support/python3/mesos-style.py
@@ -495,8 +495,11 @@ def build_virtualenv():
     """
     print('Rebuilding virtualenv...')
 
+    python3_env = os.environ.copy()
+    python3_env["PYTHON"] = sys.executable
     process = subprocess.Popen(
         [os.path.join('support', 'build-virtualenv')],
+        env=python3_env,
         stdout=subprocess.PIPE)
 
     output = ''
@@ -510,6 +513,9 @@ def build_virtualenv():
         sys.exit(1)
 
 if __name__ == '__main__':
+    if should_build_virtualenv(sys.argv[1:]):
+        build_virtualenv()
+
     # TODO(ArmandGrillet): We should only instantiate the linters
     # required to lint the files to analyze. See MESOS-8351.
     CPP_LINTER = CppLinter()

Reply via email to