Skip to content

Commit

Permalink
Auto merge of #22386 - cdeler:fix-mach-bootstrap-LinuxMint, r=jdm
Browse files Browse the repository at this point in the history
Use the base Ubuntu distro instead of LinuxMint in './mach bootstrap'

I'm LinuxMint user.

I couldn't install all dependencies via `./mach bootstrap` due to error, described in this ticket: #21732

As LinuxMint is based on the stable Ubuntu, I've made a little fix for the `bootstrap` procedure.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #21732 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because I haven't found the tests for `./mach bootstrap` (please correct me if I'm wrong)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22386)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Dec 8, 2018
2 parents 5346f74 + 7ceabce commit 8fb1b56
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions python/servo/bootstrap.py
Expand Up @@ -341,26 +341,46 @@ def check_cmake(version):
}


def get_linux_distribution():
distro, version, _ = platform.linux_distribution()

if distro == 'LinuxMint':
major, minor = version.split('.')

if major == '19':
base_version = '18.04'
elif major == '18':
base_version = '16.04'
elif major == '17':
base_version = '14.04'
else:
raise Exception('unsupported version of %s: %s' % (distro, version))

distro, version = 'Ubuntu', base_version
elif distro.lower() not in [
'centos',
'centos linux',
'debian',
'fedora',
'ubuntu',
]:
raise Exception('mach bootstrap does not support %s, please file a bug' % distro)

return distro, version


def bootstrap(context, force=False, specific=None):
'''Dispatches to the right bootstrapping function for the OS.'''

bootstrapper = None
if "windows-msvc" in host_triple():
bootstrapper = windows_msvc
elif "linux-gnu" in host_triple():
distro, version, _ = platform.linux_distribution()
if distro.lower() in [
'centos',
'centos linux',
'debian',
'fedora',
'ubuntu',
]:
context.distro = distro
context.distro_version = version
bootstrapper = LINUX_SPECIFIC_BOOTSTRAPPERS.get(specific, linux)
else:
raise Exception("mach bootstrap does not support %s, please file a bug" % distro)
distro, version = get_linux_distribution()

context.distro = distro
context.distro_version = version
bootstrapper = LINUX_SPECIFIC_BOOTSTRAPPERS.get(specific, linux)

if bootstrapper is None:
print('Bootstrap support is not yet available for your OS.')
Expand Down

0 comments on commit 8fb1b56

Please sign in to comment.