Commit graph

81 commits

Author SHA1 Message Date
Mukilan Thiyagarajan
88a35b3cc9
mach: adopt uv and avoid system python (#34632)
This allows us to use `uv` for:
1. Installing a pinned Python version
2. Installing the dependency packages using `uv`'s pip compatible interface.
4. Bootstrapping `mach` without a Python installion on the host, using `uv
   run`

This change also introduces a new 'composite' GitHub action to setup
python in the different CI workflows. There is no support for externally
managed python installations and virtual environments. These could be
added in the future.

Fixes #34095, #34547

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-16 09:20:37 +00:00
Mukilan Thiyagarajan
2f64dde623
Revert "mach: switch to uv for managing python venv (#34504)" (#34548)
This reverts commit 4103421ba5.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-10 03:43:50 +00:00
Mukilan Thiyagarajan
4103421ba5
mach: switch to uv for managing python venv (#34504)
This patch switches servo to use `uv` for both installing a pinned
Python version as well as installing the dependency packages using
`uv`'s pip compatible interface. It also introduces a new 'composite'
GitHub action to setup python in the different CI workflows.

There is no support for externally managed python installations and
virtual environments. These could be added in the future.

Fixes #34095

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-12-09 14:52:06 +00:00
Mukilan Thiyagarajan
0ce9ce8dc0
mach: Add support for paths with spaces on Windows (#32936)
The default user name in Windows installations is of the form "FirstName
LastName", so it seems likely that there will be spaces in the user's
path. Based on my testing on Windows 11, the only Servo's bootstrap
script has trouble dealing with spaces in paths. This patch fixes that
by quoting such paths correctly. Our direct and indirect dependencies
seem to handle these without issue and Servo does build and run
correctly with this patch.

In this patch, the logic for gstreamer bootstrap now uses powershell
instead of directly invoking msiexec.exe via cmd.exe as I was unable to
get the installer to run correctly, even with quoting. Some extra hacks
were necessary to propagate the exit code correctly to mach.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-08-05 14:42:21 +00:00
Martin Robinson
e331cc67c3
mach: Expose a --skip-static-analysis to mach boostrap (#32587)
This should speed up runners which just need to run the WPT tests.

Fixes #32582.
2024-06-24 17:13:09 +00:00
Martin Robinson
4a12c06309
bootstrap: Add a --skip-platform option (#32176)
This allows installign `taplo` and `crown` when you are installing
dependencies manually.
2024-04-29 15:29:11 +00:00
Martin Robinson
0c8e74dcec
mach: Don't print anything when deps are up-to-date (#31128)
I added this print statement, but after using `mach` for a while with
it, I think it is far too chatty. This change just removes the line.
Information is only printed when dependencies are installed.
2024-01-18 19:05:41 +00:00
Martin Robinson
25a9f4560e
bootstrap: Improve pip dependency resolution (#31026)
We can now use the "new" pip resolver which should prevent the
installation of conflicting packages. Also, take this opportunity to
make bootstrap more resilient. Hash all dependencies to detect
situations where a newer marker file has been installed, but for an
older branch. This should ensure that dependencies are up to date even
when switching back and forth between older and new branches.

This also updates some dependencies to be the same as the ones used for
WPT tests, which is an issue caught be the resolver.

Fixes #10611.
2024-01-15 13:16:42 +00:00
Martin Robinson
0d240b8713
deps: Raise the Python requirement to 3.10 (#31088)
This will allow us to use the pip's new dependency resolver.
2024-01-15 11:56:15 +00:00
Martin Robinson
9a1d7aabd7
bootstrap: Adding more output when installing dependencies (#31003)
It's often the case (especially with the taplo installation and on
Windows) that bootstrap is doing lots of stuff in the background for a
long amount of time. Without output it's hard to tell what exactly is
going on. This change adds more output to this process as well as
removing some Pythong 2.x era code.
2024-01-05 11:14:17 +00:00
Martin Robinson
516cc2cbca
tidy: A few small improvements and fixes (#30941)
1. Make the tidy output easier to follow
2. Integrate the WPT manifest cleanliness step into tidy
   itself and don't run it if nothing has changed in the WPT
   directory.
3. Fix an issue where Python test requirements were not installed,
   which could cause issues with some modules not being found.

Fixes #30002.
2024-01-02 06:14:51 +00:00
Corey Farwell
117d59d393
Replace virtualenv with Python's built-in venv (#30377)
* Replace virtualenv with Python's built-in venv.

* Apply Delan's suggestions and make a couple small fixes

- Fix a tidy warning about directories that don't exist
- Use shutil instead of the redundant get_exec_path
- Miscellaneous cleanups

* Fix typo in environment variable

* fix bug where pip still tries to the wrong site-packages

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2023-12-07 08:18:30 +00:00
Martin Robinson
f5627ce4cc
Remove __future__ imports that are no longer necessary (#30661)
These are no longer necessary as we always use Python 3.
2023-11-02 12:01:10 +00:00
Martin Robinson
9d9c5d3ca9
Vendor mozdebug and stop using distutils (#30659)
The version of `mozdebug` installable via pip is two years old and
Mozilla is slow to release new versions. It also uses `distutils` which
doesn't work on newer Python versions. Vendor it and stop using
`distutils` there.
2023-10-31 09:42:14 +00:00
Mukilan Thiyagarajan
117cc1da6c
mach: use importlib module instead of imp (#30645)
* mach: use `importlib` module instead of `imp`

`imp` module has been deprecated since python 3.4
and has been removed in 3.12. The recommended alternative
is to use the `importlib` module that was introduced in
python 3.1

This is required to fix the CI failures in macos builds
since GitHub runner images for macos-13 now use python 3.12

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* mach: use `importlib` module instead of `imp`

`imp` module has been deprecated since python 3.4
and has been removed in 3.12. The recommended alternative
is to use the `importlib` module that was introduced in
python 3.1

This is required to fix the CI failures in macos builds
since GitHub runner images for macos-13 now use python 3.12

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-10-30 07:53:20 +00:00
Martin Robinson
463c61f34d
Stop using distutils (#30638)
This is removed from Python 3.12 so we can no longer rely on it. All of
this functionality is either in `setuptools` or `shutil`.
2023-10-28 17:17:57 +00:00
Martin Robinson
4127ffa3fc
Remove Gecko-specific Python bootstrap logic (#30041)
Servo is no longer completely vendored into Gecko. Instead parts of
Gecko are vendored into Servo. This change removes Python mach bootstrap
code that was written to accommodate the previous situation. It's no
longer necessary.
2023-07-28 13:34:23 +00:00
Martin Robinson
633d9b0eb9 Windows bootstrap support 2023-07-03 21:40:24 +02:00
Martin Robinson
f017169ae4
Update scripts to reflect new WPT directory name 2023-06-26 10:48:02 +02:00
Martin Robinson
e22ae5daea
Allow building on paths with Unicode characters
This now works since the upgrade to Python 3, so we can remove
this code which prevents mach from running in these situations.
2023-06-22 12:25:38 +02:00
Martin Robinson
81433a8684
Convert tidy to a non-egg Python package
It seems that servo-tidy is only used by webrender in my GitHub
searches. WebRender could simply use `rustfmt` and the tidy on pypi
hasn't been updated since 2018. Converting tidy to a normal Python
package removes the maintenance burden of continually fixing the easy
install configuration.

Fixes #29094.
Fixes #29334.
2023-06-15 13:10:06 +02:00
Martin Robinson
5be14ecc3c Start organizing platform-specific Python code
This starts to split platform-specific Python code into its own module,
which should help to tidy up our mach commands and make things more
reusable.
2023-05-19 13:08:43 +02:00
cybai
49d94cb08b Run WPT sync nightly on GitHub Action 2022-08-16 00:14:55 +09:00
Josh Matthews
f4de057784 Vendor mach-1.0.0. 2021-12-21 10:57:18 -05:00
David Heidelberg
aa0484d76b
mach: cleanup after dropping Python 2 support
Signed-off-by: David Heidelberg <david@ixit.cz>
2021-07-19 14:24:29 +02:00
Kagami Sascha Rosylight
d01648d637 Fix remaining flake8 warnings 2020-06-21 03:34:32 +02:00
marmeladema
17233f2dd2 Write subprocess stdout/stderr logs to raw stdout buffer when using Python3 2019-12-10 16:11:02 +00:00
marmeladema
67c2c115c0 Allow to run mach with Python3 (>=3.5) 2019-12-09 19:31:46 +00:00
marmeladema
00cf7452ef Generate per python version virtualenv 2019-12-09 19:31:45 +00:00
Josh Mcguigan
ecc1244e59 mach bootstrap factor out common is_firefox check 2019-10-28 05:12:20 -07:00
Josh Mcguigan
01978ccf32 mach activate virtual env for bootstrap 2019-10-28 04:58:28 -07:00
marmeladema
865d7377b3 Replace call to execfile(...) by call to exec(compile(open(...)))
This is done in order to be compatible with Python3
2019-10-20 23:43:25 +01:00
Manish Goregaokar
36da6dfe98 Explicitly provide module names to mach so it doesn't try to autogenerate them
This works around https://bugzilla.mozilla.org/show_bug.cgi?id=1549636
2019-05-06 18:00:07 -07:00
TheGoddessInari
44162ceafb Don't assume the user's environment in mach_bootstrap.
On Windows with multiple Pythons installed, this was causing python2.7
to bootstrap a 3.7 virtualenv that it couldn't make use of.

PIP_NAMES wasn't used at all, and VIRTUALENV_NAMES ends up being unused
now.
2019-04-01 11:15:21 -04:00
Jan Andre Ikenmeyer
f5ab95786f
Update MPL license to https (part 1) 2018-11-19 14:46:43 +01:00
Manish Goregaokar
e72e08ea9c Allow bootstrap to be run before anything else is installed 2018-09-11 19:34:38 +05:30
Matthew Young
cb18d8aff0 removed sys.platform check & consolidated the pip invocations
The sys.platform check in need_pip_upgrade  was doing effectively the same pip invocation regardless of what
platform we were evaluating to.

Additionally, removed some duplicate definitions of the python variable which was already in scope
higher up in the function.
2018-06-06 20:25:32 -05:00
Matthew Young
9b90668915 Fix for pip invocation when setting up virtual environment during build 2018-06-06 12:51:43 -05:00
Josh Matthews
18303211cb
Upgrade pip properly on windows. 2018-05-15 10:21:50 -05:00
Josh Matthews
a568a71498
Don't suppress errors when executing mach bootstrap processes.
Omitting an argument to sys.exit causes it to default to 0, so buildbot doesn't report it as an error.
2018-05-14 09:58:38 -04:00
Xidorn Quan
29d9c85c56 Add wptserve into python import paths. 2018-03-07 17:14:25 +11:00
Simon Wörner
663d6bc0c5 Enable pip output in mach_bootstrap.py 2017-11-24 20:47:11 +01:00
Simon Wörner
f08b473c50 Redirect stdout and stderr to file to avoid deadlock 2017-11-24 20:47:00 +01:00
Josh Matthews
ca340eca39 Use upstream wptrunner from web-platform-tests. 2017-10-05 00:43:03 +02:00
James Graham
06cdf7bb3b Update mach bootstrap for changes to wpt harness path in gecko
Gecko is now using the wpt harness under the wpt tools directory
rather than a copy in an adjacent directory. Therefore the path to the
requirements files, and the required model paths, have changed.
2017-06-05 08:52:48 +01:00
Aneesh Agrawal
022f0aa34a Remove more deprecated Windows GNU code/docs 2017-04-16 22:12:17 -04:00
Gregory Szorc
d27be52371 Find WPT files in Firefox repository
The Servo repository is now (mostly) vendored in the Firefox Mercurial
repository. For size and duplication reasons, the tests/wpt directory is
not included in the vendored copy.

This causes problems when running `mach` from the Firefox repository
because `mach` references pip requirements files and module search
paths from WPT.

This commit adds code to detect when Servo's mach is running from a
Firefox source tree and to resolve WPT paths to the Firefox location
if appropriate. This enables `mach` to "just work" when running
from the servo/ directory in the Firefox repository.

The file looked for to identify the Firefox repository is identical
to what Firefox's `mach` script uses.

A potential issue with using Firefox's WPT files is that they may be
different from those in the Servo repository and this could lead to
differences in behavior - possibly even an error when loading/running
`mach`. However, the behavior before this commit was that Servo's
`mach` never worked in the Firefox repository (due to missing WPT
files). And post-commit it does. So this seems like a "perfect is the
enemy of good" scenario.
2017-02-03 23:38:41 -08:00
Aneesh Agrawal
b4f5086305 Add a Salt bootstrapper
The Salt bootstrapper invokes Salt during `./mach bootstrap`
to install Servo's build dependencies.
It uses salt-call pinned to the same version of Salt as used in saltfs.

Currently, the implementation uses gitfs and reads directly from
the master branch of the saltfs repo;
in the future this should be changed when the relevant Salt states
are moved in-tree as part of Dockerization for TaskCluster.

We have not Salted our Windows machines, so the existing Windows
bootstrappers are retained. Currently this is only tested on
Ubuntu Trusty.

Salt uses various system python libraries,
including `python-apt` on Debian-based OSes to interact with apt.
`python-apt` does not seem to be installable via a requirements.txt
file, and the versions available on PyPI are far behind the versions
installed on actual Ubuntu machines.
Additionally, adding `python-apt` as an unconditional python dependency
would add bloat for users of other OSes, and lead to more churn
as additional OSes are supported.
However, as `python-apt` is already installed via apt on these machines,
we can allow Salt to instead use the module by using
`--system-site-packages` for the python virtualenv.
We also add the `-I` flag to `pip install` to ensure we have a local,
untouched copy of any other python packages used.
However, because this prints system-level Python packages in scope,
it slightly breaks isolation, so it is important to always pin
all dependencies in the requirements files.
2017-01-17 11:01:09 -05:00
Peter
044b5ff26b Commit that fixes the issue #11074 by upgrading pip whenever virtualenv is created. 2016-12-03 20:07:11 +03:00
Jack Moffitt
8e8519d038 Fix test-wpt and test-css for Windows.
In addition to minor changes for Windows, this forces Windows Python to
be used for all Windows builds (instead of using Windows Python only for
pc-windows-msvc builds).
2016-11-16 10:38:15 -07:00