mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: support installing dependencies on non-ubuntu. (#14010)
We should not fast-return if someone tries to run `npx playwright install-deps` on Debian. Instead, we should warn users, fallback to Ubuntu 20.04 dependencies, and proceed.
This commit is contained in:
parent
572f6d2705
commit
3ba1ea5c39
@ -75,8 +75,13 @@ export async function installDependenciesWindows(targets: Set<DependencyGroup>,
|
|||||||
|
|
||||||
export async function installDependenciesLinux(targets: Set<DependencyGroup>, dryRun: boolean) {
|
export async function installDependenciesLinux(targets: Set<DependencyGroup>, dryRun: boolean) {
|
||||||
const libraries: string[] = [];
|
const libraries: string[] = [];
|
||||||
|
let platform = hostPlatform;
|
||||||
|
if (platform === 'generic-linux' || platform === 'generic-linux-arm64') {
|
||||||
|
console.warn('BEWARE: your OS is not officially supported by Playwright; installing dependencies for Ubuntu as a fallback.'); // eslint-disable-line no-console
|
||||||
|
platform = hostPlatform === 'generic-linux' ? 'ubuntu20.04' : 'ubuntu20.04-arm64';
|
||||||
|
}
|
||||||
for (const target of targets) {
|
for (const target of targets) {
|
||||||
const info = deps[hostPlatform];
|
const info = deps[platform];
|
||||||
if (!info) {
|
if (!info) {
|
||||||
console.warn('Cannot install dependencies for this linux distribution!'); // eslint-disable-line no-console
|
console.warn('Cannot install dependencies for this linux distribution!'); // eslint-disable-line no-console
|
||||||
return;
|
return;
|
||||||
@ -85,7 +90,7 @@ export async function installDependenciesLinux(targets: Set<DependencyGroup>, dr
|
|||||||
}
|
}
|
||||||
const uniqueLibraries = Array.from(new Set(libraries));
|
const uniqueLibraries = Array.from(new Set(libraries));
|
||||||
if (!dryRun)
|
if (!dryRun)
|
||||||
console.log('Installing Ubuntu dependencies...'); // eslint-disable-line no-console
|
console.log(`Installing dependencies...`); // eslint-disable-line no-console
|
||||||
const commands: string[] = [];
|
const commands: string[] = [];
|
||||||
commands.push('apt-get update');
|
commands.push('apt-get update');
|
||||||
commands.push(['apt-get', 'install', '-y', '--no-install-recommends',
|
commands.push(['apt-get', 'install', '-y', '--no-install-recommends',
|
||||||
@ -187,10 +192,10 @@ export async function validateDependenciesLinux(sdkLanguage: string, linuxLddDir
|
|||||||
// Check Ubuntu version.
|
// Check Ubuntu version.
|
||||||
const missingPackages = new Set();
|
const missingPackages = new Set();
|
||||||
|
|
||||||
const libraryToPackageNameMapping = {
|
const libraryToPackageNameMapping = deps[hostPlatform] ? {
|
||||||
...(deps[hostPlatform]?.lib2package || {}),
|
...(deps[hostPlatform]?.lib2package || {}),
|
||||||
...MANUAL_LIBRARY_TO_PACKAGE_NAME_UBUNTU,
|
...MANUAL_LIBRARY_TO_PACKAGE_NAME_UBUNTU,
|
||||||
};
|
} : {};
|
||||||
// Translate missing dependencies to package names to install with apt.
|
// Translate missing dependencies to package names to install with apt.
|
||||||
for (const missingDep of missingDeps) {
|
for (const missingDep of missingDeps) {
|
||||||
const packageName = libraryToPackageNameMapping[missingDep];
|
const packageName = libraryToPackageNameMapping[missingDep];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user