Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1741581 - Attempt to get virtualenv name from environment #965

Merged
merged 2 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.25.0...main)

* [#965](https://github.com/mozilla/glean.js/pull/965): Attempt to infer the Python virtualenv folder from the environment before falling back to the default `.venv`.
* Users may provide a folder name through the `VIRTUAL_ENV` environment variable.
* If the user is inside an active virtualenv the `VIRTUAL_ENV` environment variable is already set by Python. See: https://docs.python.org/3/library/venv.html.

# v0.25.0 (2021-11-15)

[Full changelog](https://github.com/mozilla/glean.js/compare/v0.24.0...v0.25.0)
Expand Down
11 changes: 9 additions & 2 deletions glean/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ import log, { LoggingLevel } from "./core/log.js";

const LOG_TAG = "CLI";

// The name of the directory which will contain the Python virtual environment
// The name of the directory which contains / will contain the Python virtual environment
// used to run the glean-parser.
const VIRTUAL_ENVIRONMENT_DIR = ".venv";
//
// > When a virtual environment is active, the VIRTUAL_ENV environment variable
// > is set to the path of the virtual environment. This can be used to check if
// > one is running inside a virtual environment.
//
// See: https://docs.python.org/3/library/venv.html
// (Also applies to envs created using virtualenv though)
const VIRTUAL_ENVIRONMENT_DIR = process.env.VIRTUAL_ENV?.split("/").slice(-1)[0] || ".venv";
brizental marked this conversation as resolved.
Show resolved Hide resolved

// The version of glean_parser to install from PyPI.
const GLEAN_PARSER_VERSION = "4.1.1";
Expand Down