Skip to content

Commit

Permalink
Add --no-user in pip install commands (#1257)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Dec 7, 2023
1 parent 90f7511 commit edc0d8c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog


### NEXT

* `tasks.py`: Always include `--no-user` in `pip install` commands to avoid the "can not combine --user and --target" error in Windows ([PR #1257](https://github.com/versatica/mediasoup/pull/1257)).


### 3.13.9

* Update worker liburing dependency to 2.4-2 ([PR #1254](https://github.com/versatica/mediasoup/pull/1254)).
Expand Down
2 changes: 1 addition & 1 deletion npm-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function installInvoke()
// Install pip invoke into custom location, so we don't depend on system-wide
// installation.
executeCmd(
`"${PYTHON}" -m pip install --upgrade --target="${PIP_INVOKE_DIR}" invoke`,
`"${PYTHON}" -m pip install --upgrade --no-user --target="${PIP_INVOKE_DIR}" invoke`,
/* exitOnError */ true
);
}
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"@octokit/rest": "^20.0.2",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.3",
"@types/node": "^20.10.4",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"eslint": "^8.55.0",
Expand All @@ -120,6 +120,6 @@
"pick-port": "^1.0.1",
"sctp": "^1.0.0",
"ts-jest": "^29.1.1",
"typescript": "^5.3.2"
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion worker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ invoke:
ifeq ($(wildcard $(PIP_INVOKE_DIR)),)
# Install pip invoke into custom location, so we don't depend on system-wide
# installation.
$(PYTHON) -m pip install --upgrade --target="$(PIP_INVOKE_DIR)" invoke
$(PYTHON) -m pip install --upgrade --no-user --target="$(PIP_INVOKE_DIR)" invoke
endif

meson-ninja: invoke
Expand Down
10 changes: 6 additions & 4 deletions worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
MEDIASOUP_INSTALL_DIR = os.getenv('MEDIASOUP_INSTALL_DIR') or f'{MEDIASOUP_OUT_DIR}/{MEDIASOUP_BUILDTYPE}';
BUILD_DIR = os.getenv('BUILD_DIR') or f'{MEDIASOUP_INSTALL_DIR}/build';
# Custom pip folder for invoke package.
# NOTE: We invoke `pip install` always with `--no-user` to make it not complain
# about "can not combine --user and --target".
PIP_INVOKE_DIR = f'{MEDIASOUP_OUT_DIR}/pip_invoke';
# Custom pip folder for meson and ninja packages.
PIP_MESON_NINJA_DIR = f'{MEDIASOUP_OUT_DIR}/pip_meson_ninja';
Expand Down Expand Up @@ -106,14 +108,14 @@ def meson_ninja(ctx):
# fallback to command without `--system` if the first one fails.
try:
ctx.run(
f'"{PYTHON}" -m pip install --system --upgrade --target="{PIP_MESON_NINJA_DIR}" pip setuptools',
f'"{PYTHON}" -m pip install --system --upgrade --no-user --target="{PIP_MESON_NINJA_DIR}" pip setuptools',
echo=True,
hide=True,
shell=SHELL
);
except:
ctx.run(
f'"{PYTHON}" -m pip install --upgrade --target="{PIP_MESON_NINJA_DIR}" pip setuptools',
f'"{PYTHON}" -m pip install --upgrade --no-user --target="{PIP_MESON_NINJA_DIR}" pip setuptools',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
Expand All @@ -126,7 +128,7 @@ def meson_ninja(ctx):
# Install meson and ninja using pip into our custom location, so we don't
# depend on system-wide installation.
ctx.run(
f'"{PYTHON}" -m pip install --upgrade --target="{PIP_MESON_NINJA_DIR}" {pip_build_binaries} meson=={MESON_VERSION} ninja=={NINJA_VERSION}',
f'"{PYTHON}" -m pip install --upgrade --no-user --target="{PIP_MESON_NINJA_DIR}" {pip_build_binaries} meson=={MESON_VERSION} ninja=={NINJA_VERSION}',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
Expand Down Expand Up @@ -371,7 +373,7 @@ def lint(ctx):
if not os.path.isdir(PIP_PYLINT_DIR):
# Install pylint using pip into our custom location.
ctx.run(
f'"{PYTHON}" -m pip install --upgrade --target="{PIP_PYLINT_DIR}" pylint=={PYLINT_VERSION}',
f'"{PYTHON}" -m pip install --upgrade --no-user --target="{PIP_PYLINT_DIR}" pylint=={PYLINT_VERSION}',
echo=True,
pty=PTY_SUPPORTED,
shell=SHELL
Expand Down

0 comments on commit edc0d8c

Please sign in to comment.