Commit graph

60 commits

Author SHA1 Message Date
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
UK992
b9f39cb111 Warn and exit mach if it detects MinGW Python 2016-10-10 18:27:48 +02:00
Ravi Shankar
b579841183 Minor cleanup of mach and bootstrap script 2016-09-01 17:25:36 +05:30
Ravi Shankar
f83fe9e39b Ensure that we get python and pip from virtualenv 2016-09-01 17:00:18 +05:30
J. Ryan Stinnett
3bc2a5632a Allow running WPT in Firefox 2016-07-21 19:31:24 -05:00
bors-servo
e7a55ae55e Auto merge of #10618 - zwn:fix-windows-build, r=larsbergstrom
Ensure virtualenv activates

Fixes #10595. For more info see #10595 or the commit message.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10618)
<!-- Reviewable:end -->
2016-07-17 15:58:12 -07:00
Per Lundberg
22fddac3ad Added detection for case-sensitive file systems
This is needed for the moment because of a bug in virtualenv (reported upstream).
2016-06-14 20:24:06 +03:00
edunham
a1a8e08dca Create mach package
* Split package commands into their own file
* Delete spurious files from build dir
* Create runservo.sh to invoke servo with the right browserhtml incantation
* Tar it all up with the date and time in the filename
2016-06-03 14:47:21 -07:00
Adrian Utrilla
0fff10c7e9
Mach now shows stderr when a virtualenv or pip call fails (fixes #11055) 2016-05-07 17:36:27 +02:00
Corey Farwell
7725e644e9 Upgrade mach to 0.6; stop vendoring mach.
When I originally rewrote Servo's mach bootstrapping (using virtualenv
w/ requirements.txt in #7103), I didn't specify mach as a requirement
because a new version hadn't been published in a while. Now that 0.6
is out, I asked the mach maintainers to publish a new version on PyPI,
so now we can fetch it like the other Python dependencies.

Fixes https://github.com/servo/servo/issues/10728.
2016-05-02 19:27:52 -04:00
Zbynek Winkler
7002fbedd7 Ensure virtualenv activates.
There are two changes:
 * remove quoting which causes virtuaenv not activate
 * check virtualenv actually activated

If the quoting added in the fix in #8394 (4ff8d3ad9c) kicks in, it
causes virtualenv to fail to activate.

For the common case it is no op:
```python
>>> from pipes import quote
>>> print quote('common/case')
common/case
```

When the path actually needs quoting, this is what happens:

```python
>>> print quote('test spaces')
'test spaces'
>>> print quote('windows\\path')
'windows\\path'
```

Note the embedded quotes.

Virtualenv in activate_this.py uses __file__ to build the path that
should be added to PATH:

```python
>>> print os.getcwd()
C:\software\git
>>> print os.path.abspath(quote('windows\\path'))
C:\software\git\'windows\path'
>>>
```

The constructed path is not valid. Adding it at the beginning of PATH
has no effect. This issue affects any case when the call to `quote`
kicks in.
2016-04-21 08:23:03 +02:00
askeing
bfe460de9e Package tidy
- Modified the testing commands
- Added the requirements
- Moved python/tidy/tests to python/tidy/servo_tidy_tests for self tidy tests
2016-04-14 15:55:25 +08:00
Petr Klíma
c0bc90d122 Handle exception with errormessage on topdir with Unicode characters.
https://github.com/servo/servo/issues/10002
2016-03-15 11:08:38 +01:00
Suvish Varghese Thoovamalayil
ded08d5fe6 Exit mach with an error when building on a path with spaces. Fixes #9442 2016-02-11 16:28:58 +05:30
Adam Casey
25b0ee22f2 Fix build on windows when default python is MSYS64 python 2016-01-23 15:04:34 +00:00
Jason Williams
13d98f153a adding check for windows then using Scripts instead of bin 2016-01-22 19:27:29 -06:00
Corey Farwell
4ff8d3ad9c Make virtualenv more tolerant of spaces in directory names
Fixes #8390
2015-11-07 11:28:52 -05:00
Benjamin Herr
a4fa004c39 mach_bootstrap: Don't get confused by interrupts
When mach_bootstrap got interrupted while it's setting up virtualenv or
calling out to pip, it wouldn't repeat that step on subsequent runs, and
mach fails because its environment isn't set up properly or dependencies
are missing.

So now we re-run virtualenv if activate_this.py doesn't exist, and only
create the marker file for required packages after pip has returned
successfully.
2015-11-05 21:04:53 +01:00
Corey Farwell
1a9263c2b4 Expand list of Python executable names to search in PATH
Fixes #7784
2015-09-29 18:13:43 -04:00
Anthony Broad-Crawford
2e0e2288ed Added error handling and improved error messaging when running mach without python's virtualenv or pip installed 2015-09-21 13:38:30 -05:00
Aidan Hobson Sayers
9737b2375e Create a marker file to avoid running pip when possible 2015-09-14 20:55:22 +01:00
Corey Farwell
244af42d89 Use OS-agnostic filesystem paths in Python
This will eventually need to be done for #1908
2015-09-08 21:16:02 +02:00