Граф коммитов

119 Коммитов

Автор SHA1 Сообщение Дата
Ricky Stewart b2952039f9 Bug 1667152 - Add `--requirements` argument to `mach python` r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D91313
2020-11-20 19:29:26 +00:00
Noemi Erli f24bd4fcff Backed out 4 changesets (bug 1666345, bug 1661624, bug 1667152, bug 1666347) for causing mochitest failures CLOSED TREE
Backed out changeset 8ce536574e74 (bug 1666347)
Backed out changeset 7cc5b13a3bf6 (bug 1666345)
Backed out changeset e112876ba18b (bug 1661624)
Backed out changeset 0f03ce337449 (bug 1667152)
2020-11-16 21:06:12 +02:00
Ricky Stewart 3bc837a830 Bug 1667152 - Add `--requirements` argument to `mach python` r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D91313
2020-11-13 20:21:43 +00:00
Mihai Alexandru Michis 06103d0e92 Backed out 3 changesets (bug 1666345, bug 1667152, bug 1661624) for causing mochitest timeouts.
CLOSED TREE

Backed out changeset baa1f7a615e4 (bug 1666345)
Backed out changeset b6646baa866d (bug 1661624)
Backed out changeset e4d550db6037 (bug 1667152)
2020-11-13 22:14:45 +02:00
Ricky Stewart 7bf2fa711b Bug 1667152 - Add `--requirements` argument to `mach python` r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D91313
2020-11-12 18:02:17 +00:00
smolnar 1e6e466d99 Backed out 4 changesets (bug 1666347, bug 1667152, bug 1661624, bug 1666345) for causing mingw bustage. CLOSED TREE
Backed out changeset 19f707f5c097 (bug 1666347)
Backed out changeset 3732ee259759 (bug 1666345)
Backed out changeset 353d3c9e74b9 (bug 1661624)
Backed out changeset a651515586a8 (bug 1667152)
2020-11-12 19:55:58 +02:00
Ricky Stewart fe799c848a Bug 1667152 - Add `--requirements` argument to `mach python` r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D91313
2020-11-12 16:06:15 +00:00
Mike Hommey 688e669eaf Bug 1675707 - Allow not to activate the virtualenv when running mach python. r=firefox-build-system-reviewers,mhentges
This allows PATH not to be altered such that `python` would resolve to
the virtualenv python.

Differential Revision: https://phabricator.services.mozilla.com/D96167
2020-11-06 21:53:56 +00:00
Mike Hommey af94e85e8d Bug 1675675 - Only put mach_bootstrap paths in PYTHONPATH for mach python --no-virtualenv. r=firefox-build-system-reviewers,rstewart
With PYTHONPATH containing other directories, such as the python ones,
bad things can happen when the python script that is being run then
goes on to subprocess.Popen a python process for a different virtualenv,
or a different version, or whatever.

Differential Revision: https://phabricator.services.mozilla.com/D96155
2020-11-06 17:30:58 +00:00
Ricky Stewart 02a7b4ebdf Bug 1654103: Standardize on Black for Python code in `mozilla-central`.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-26 18:34:53 +00:00
Bogdan Tara da1098d4aa Backed out 10 changesets (bug 1654103, bug 1672023, bug 1518999) for PanZoomControllerTest.touchEventForResult gv-junit failures CLOSED TREE
Backed out changeset ff3fb0b4a512 (bug 1672023)
Backed out changeset e7834b600201 (bug 1654103)
Backed out changeset 807893ca8069 (bug 1518999)
Backed out changeset 13e6b92440e9 (bug 1518999)
Backed out changeset 8b2ac5a6c98a (bug 1518999)
Backed out changeset 575748295752 (bug 1518999)
Backed out changeset 65f07ce7b39b (bug 1518999)
Backed out changeset 4bb80556158d (bug 1518999)
Backed out changeset 8ac8461d7bd7 (bug 1518999)
Backed out changeset e8ba13ee17f5 (bug 1518999)
2020-10-24 03:36:18 +03:00
Ricky Stewart c0cea3b0fa Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-23 20:40:42 +00:00
Dorel Luca 1ff59cb7a3 Backed out changeset 7558c8821a07 (bug 1654103) for multiple failures. CLOSED TREE 2020-10-22 03:51:06 +03:00
Ricky Stewart 50762dacab Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-21 21:27:27 +00:00
Ricky Stewart a7be3f2b68 Bug 1665494 - In `mach python-test`, don't install requirements.txt in parallel r=ahal
If you set a `DEFAULT` `requirements` file in a Python test manifest, the current implementation of `python-test` will try (and usually fail) to install the file once for every test file in parallel. Instead, initializing the environment should be done once when the command starts up.

Differential Revision: https://phabricator.services.mozilla.com/D90475
2020-09-18 01:38:46 +00:00
Ricky Stewart 4c6985333a Bug 1659539 - [python-test] Remove '--python' and stop using pipenv to manage virtualenvs r=ahal
Pipenv is heavy weight and overkill for the purposes it is being used. We'd like to remove it from the tree and |mach python-test| was one of the last remanining use cases.

Remove the `--python` command-line argument as a result. Users who wish to run unit tests with Python 2 can do `MACH_PY2=1 ./mach python-test ...` or `python2 ./mach python-test ...`.

Also update a few unit tests that would break otherwise in the presence of this change.

There were a couple lines in the `setup.py` for `mozlog` that were problematic for tests and was resulting in errors due to the `mozlog` plugin being loaded by `pytest` more than once. We just delete those lines and bump up the major version number of the package to fix it.

Differential Revision: https://phabricator.services.mozilla.com/D88296
2020-09-02 17:05:24 +00:00
Mitchell Hentges 7759de2362 Bug 1657719: Don't create init_py3_py3 venv in python-test r=firefox-build-system-reviewers,rstewart
To ensure that a python 3 virtualenv exists for tests, python-test will ensure that it's created (regardless of which version of python is currently in use).
However, the existing logic was incorrectly creating an "extra py3 virtualenv", even if currently running python 3 and having already created a "first" py3 virtualenv

Differential Revision: https://phabricator.services.mozilla.com/D86269
2020-08-07 22:11:41 +00:00
Ricky Stewart 3ddb065650 Bug 1656611 - Remove `objdir` support from `virtualenv_packages.txt` handling r=mhentges,froydnj
I noticed that the `objdir:build` entry in `build/virtualenv_packages.txt` entry was apparently unused. This originates from bug 841713, seven years ago, when the `objdir` handling was introduced. Today, this doesn't appear to be serving a purpose. There is no Python library in my `$objdir/build` directory; nor can I see anything in `build/moz.build` or any related files suggesting one could ever appear. I can only assume this feature has outlived its usefulness, so delete it and the relevant in-tree support.

This necessitates slightly changing the signature and implementation of the `activate_pipenv()` method; also update all callers.

Differential Revision: https://phabricator.services.mozilla.com/D85635
2020-08-07 16:03:36 +00:00
Bogdan Tara 57ed67928b Backed out changeset 760fc38c793b (bug 1656611) for doc failure complaining about virtualenv_root CLOSED TREE 2020-08-07 18:57:56 +03:00
Ricky Stewart 41e473f17b Bug 1656611 - Remove `objdir` support from `virtualenv_packages.txt` handling r=mhentges,froydnj
I noticed that the `objdir:build` entry in `build/virtualenv_packages.txt` entry was apparently unused. This originates from bug 841713, seven years ago, when the `objdir` handling was introduced. Today, this doesn't appear to be serving a purpose. There is no Python library in my `$objdir/build` directory; nor can I see anything in `build/moz.build` or any related files suggesting one could ever appear. I can only assume this feature has outlived its usefulness, so delete it and the relevant in-tree support.

This necessitates slightly changing the signature and implementation of the `activate_pipenv()` method; also update all callers.

Differential Revision: https://phabricator.services.mozilla.com/D85635
2020-08-06 18:21:35 +00:00
Hamzah b7e6b41fc5 Bug 1594914 - Convert mach python-test to run with python 3 r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D77872
2020-08-04 17:40:58 +00:00
Andrew Halberstadt d0fbcca0b6 Bug 985141 - [mozbuild] Remove leading underscore from MozbuildObject._activate_virtualenv, r=firefox-build-system-reviewers,perftest-reviewers,andi,AlexandruIonescu,rstewart
This function is used all across the tree and should be considered a public API.

Differential Revision: https://phabricator.services.mozilla.com/D85045
2020-07-28 16:06:10 +00:00
Mihai Alexandru Michis 53a4dbf91a Backed out changeset 19269e470c71 (bug 1594914) for causing bustages.
CLOSED TREE
2020-07-09 01:36:29 +03:00
Hamzah 0606c70920 Bug 1594914 - Convert mach python-test to run with python 3 r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D77872
2020-07-08 19:15:27 +00:00
Mitchell Hentges 0bc6909185 Bug 1621960: Change |mach python| default from Python 2 to Python 3 r=rstewart
Depends on D77967

Differential Revision: https://phabricator.services.mozilla.com/D78181
2020-06-10 16:10:08 +00:00
Noemi Erli 9017f973e3 Backed out 4 changesets (bug 1621960) for causing Android bustages CLOSED TREE
Backed out changeset f36a95234a5f (bug 1621960)
Backed out changeset 0e4661c9061d (bug 1621960)
Backed out changeset 3e2cbe4dd777 (bug 1621960)
Backed out changeset d7eb101e5df7 (bug 1621960)
2020-06-09 20:59:26 +03:00
Mitchell Hentges 4006a0890c Bug 1621960: Change |mach python| default from Python 2 to Python 3 r=rstewart
Depends on D77967

Differential Revision: https://phabricator.services.mozilla.com/D78181
2020-06-09 16:44:51 +00:00
Csoregi Natalia 160736caed Backed out changeset 4376d47f325b (bug 1639624) for bustage. CLOSED TREE 2020-05-21 03:58:54 +03:00
Ricky Stewart 5aefcd726b Bug 1639624 - Don't unconditionally import `VirtualenvManager` in `python/mach_commands.py`. r=froydnj
Similar reasoning to bug 1638780.

Differential Revision: https://phabricator.services.mozilla.com/D76221
2020-05-20 23:32:43 +00:00
Ricky Stewart 2399f846de Bug 1628838 - Fix `mach python` on Windows by unsetting PYTHONUNBUFFERED. r=glandium
The existence of this environment variable breaks the Python shell on Windows, so make sure it's unset (but only in this case to avoid regressing bug 1627873).

Differential Revision: https://phabricator.services.mozilla.com/D70542
2020-04-21 14:07:19 +00:00
Andrew Halberstadt 20606598b3 Bug 1604360 - [python] Fix ./mach python --ipython, r=mars
We recently updated the version of pip we use, and it no longer supports
--use-wheels.

Differential Revision: https://phabricator.services.mozilla.com/D57404

--HG--
extra : moz-landing-system : lando
2019-12-17 23:05:29 +00:00
Māris Fogels 030fc0897c Bug 1590745 - Make the $PYTHON3 build var use a virtualenv r=mshal
Make the $PYTHON3 build var point to a full virtualenv bootstrapped with
the same libraries as the $PYTHON Python 2 build var. This allows us to
upgrade build tasks from $PYTHON to $PYTHON3.

This patch adds some debug logging and documentation to the Python
2 virtualenv so that it is easier to diagnose issues that may arise
from running two different Python interpreters in re-entrant
multiprocess routines.

Differential Revision: https://phabricator.services.mozilla.com/D50819

--HG--
extra : moz-landing-system : lando
2019-12-03 18:49:06 +00:00
Sebastian Hengst 4d554f0a10 Backed out changeset 3034ec8681ac (bug 1590745) for breaking local macOS 10.15 builds (bug 1600720). a=backout 2019-12-03 19:06:29 +01:00
Māris Fogels 75d85af992 Bug 1590745 - Make the $PYTHON3 build var use a virtualenv r=mshal
Make the $PYTHON3 build var point to a full virtualenv bootstrapped with
the same libraries as the $PYTHON Python 2 build var. This allows us to
upgrade build tasks from $PYTHON to $PYTHON3.

This patch adds some debug logging and documentation to the Python
2 virtualenv so that it is easier to diagnose issues that may arise
from running two different Python interpreters in re-entrant
multiprocess routines.

Differential Revision: https://phabricator.services.mozilla.com/D50819

--HG--
extra : moz-landing-system : lando
2019-11-25 20:23:03 +00:00
Māris Fogels 8200f05c80 Bug 1598830 - Fix sys.executable in the macOS Python tests r=ahal
Homebrew on OS X will change Python's sys.executable to a custom value
which messes with mach's virtualenv handling code. Override Homebrew's
changes with the correct sys.executable value.

Differential Revision: https://phabricator.services.mozilla.com/D54602

--HG--
extra : moz-landing-system : lando
2019-11-26 15:01:30 +00:00
Andrew Halberstadt 497cccb9c6 Bug 1596431 - [python] Add an --ipython flag to |mach python|, r=firefox-build-system-reviewers,chmanchester
This will install ipython into the default virtualenv if it doesn't exist. Unless --no-virtualenv
is specified in which case an error will be printed.

Differential Revision: https://phabricator.services.mozilla.com/D53030

--HG--
extra : moz-landing-system : lando
2019-11-19 20:54:40 +00:00
Anmol Agarwal d2dbcf8eba Bug 1433941 - Passed remainder arguments as it is |mach python-test| r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D47832

--HG--
extra : moz-landing-system : lando
2019-10-04 18:32:37 +00:00
Anmol Agarwal 35d00cbafb Bug 1494090 - Added -x option to |mach python-test| r=ahal
Bug 1494090 - Added -x option to |mach python-test|

Differential Revision: https://phabricator.services.mozilla.com/D47321

--HG--
extra : moz-landing-system : lando
2019-09-30 20:18:08 +00:00
Andrew Halberstadt 898dfb96b4 Bug 1567642 - [lint.flake8] Fix misc flake8 under Python 3 lint issues r=gbrown
Differential Revision: https://phabricator.services.mozilla.com/D45417

--HG--
extra : moz-landing-system : lando
2019-09-24 14:44:01 +00:00
Henri Sivonen 37bd3aa18a Bug 1557278 - Avoid implicit conversion to Unicode when rewriting log lines. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D33942

--HG--
extra : moz-landing-system : lando
2019-06-06 16:46:40 +00:00
Henrik Skupin 855136af7f Bug 1504308 - [mach] Pass path to Python interpreter to python-tests. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D25760

--HG--
extra : moz-landing-system : lando
2019-04-03 21:02:55 +00:00
Bogdan Tara dcba550436 Backed out changeset 15f725097416 (bug 1504308) for python related build bustages CLOSED TREE 2019-04-03 00:07:48 +03:00
Henrik Skupin 75bafbf6b3 Bug 1504308 - [mach] Pass path to Python interpreter to python-tests. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D25760

--HG--
extra : moz-landing-system : lando
2019-04-02 15:26:39 +00:00
Andrew Halberstadt e2b3fa3969 Bug 1533043 - [python-test] Add ability for individual tests to have pypi dependencies, r=davehunt
Sometimes tools install pypi at runtime via mach (e.g self.install_pip_package
/ self.install_pip_requirements). It's difficult to test these modules with
pytest because we usually won't be going through mach.

This gives tests the ability to depend on external pypi packages the same way
they might get installed when running via mach.

Note, I only added support for requirements.txt here because
python/mozbuild/mozbuild/virtualenv.py's 'install_pip_package' function is
completely busted with modern pip. And the pip used with |mach python-test| is
more modern than the one used with the regular build venv due to pipenv. We'll
need to fix this eventually, but that's another bug for another day.

Differential Revision: https://phabricator.services.mozilla.com/D22784

--HG--
extra : moz-landing-system : lando
2019-03-13 14:51:37 +00:00
Ted Mielczarek 54b3bbd1ce bug 1505205 - don't write telemetry for recursive mach command invocations. r=firefox-build-system-reviewers,chmanchester
This change tries to ensure that we don't write telemetry data for mach
commands invoked recursively as part of other mach commands. The intent of
build system telemetry is to only collect data about commands that users are
invoking directly.

There are two ways that we found mach commands can be recursively invoked:
* By running a python subprocess to recursively invoke mach (used in
  `mach bootstrap` to call `mach artifact toolchain`)
* By using `Registrar.dispatch` to delegate to a sub-command (used by many
  build system commands to invoke `mach build`).

The subprocess case is handled here by having mach set a `MACH_MAIN_PID`
environment variable whose value is the current process' pid on startup if it
does not already exist in the environment. Telemetry code then checks that the
value of that variable matches the current pid and skips writing telemetry data
if not.

The dispatch case is handled by making `MachRegistrar` store the current depth
of the command stack and pass it to the `post_dispatch_handler` which will skip
writing telemetry data if depth != 1.

Additionally the `should_skip_dispatch` function in mach_bootstrap is renamed
to `should_skip_telemetry_submission`, which was its original intent. The
combination of checks added in this change should be sufficient for deciding
when to write telemetry data, and we were not collecting telemetry for the set
of mach commands in that function (which included `mach bootstrap`).

In order to facilitate writing a test for the dispatch case this change adds a
`mach python --exec-file` option to execute Python code directly in the context
of the `mach python` command.

Differential Revision: https://phabricator.services.mozilla.com/D11207

--HG--
extra : moz-landing-system : lando
2018-11-10 19:04:30 +00:00
Andrew Halberstadt 7955dcc501 Bug 1476390 - [python-test] Default number of processes to multiprocessing.cpu_count() r=davehunt
Differential Revision: https://phabricator.services.mozilla.com/D2201

--HG--
extra : moz-landing-system : lando
2018-07-18 16:15:48 +00:00
Dave Hunt 2847cb1fcb Bug 1473727 - Avoid recreating virtual environment every time by using a unique environment for each Python version; r=ahal,dustin
This patch uses the PIPENV_PYTHON environment variable to append a suffix to the created virtual environment path according to the version specified. It also uses the PIPENV_DEFAULT_PYTHON_VERSION environment variable to avoid recreating the virtual environment every time. With these changes we are able to switch back and forth between Python versions without the expense of recreating environments, however there is a risk of these environments becoming stale. In this scenario it may be necessary to clobber the virtual environment root within the obj dir.

MozReview-Commit-ID: C4vuwNh04CP

--HG--
extra : rebase_source : 301c8418fe5b873ffadec37af11e98cfda8667b8
2018-07-09 14:57:38 +01:00
Andreea Pavel 3a4de89781 Backed out changeset d75218b99a04 (bug 1473727) for build bustages on a CLOSED TREE 2018-07-10 18:17:47 +03:00
Dave Hunt 4c269c0a47 Bug 1473727 - Avoid recreating virtual environment every time by using a unique environment for each Python version; r=ahal,dustin
This patch uses the PIPENV_PYTHON environment variable to append a suffix to the created virtual environment path according to the version specified. It also uses the PIPENV_DEFAULT_PYTHON_VERSION environment variable to avoid recreating the virtual environment every time. With these changes we are able to switch back and forth between Python versions without the expense of recreating environments, however there is a risk of these environments becoming stale. In this scenario it may be necessary to clobber the virtual environment root within the obj dir.

MozReview-Commit-ID: C4vuwNh04CP

--HG--
extra : rebase_source : ba34e415fa21683bc2a39231651587fa30ad0242
2018-07-09 14:57:38 +01:00
Dave Hunt cc768253df Bug 1466211 - Use --python for selecting target Python when using |mach python-test|; r=ahal
MozReview-Commit-ID: J8DSmX8mItb

--HG--
extra : rebase_source : 0e471ade56c7bb78fe090f05e7657ae1f35f7936
2018-06-13 14:18:21 -07:00