Skip to content

Commit

Permalink
Merge pull request #965 from brizental/1741581-use-existing-venv
Browse files Browse the repository at this point in the history
Bug 1741581 - Attempt to get virtualenv name from environment
  • Loading branch information
brizental committed Nov 18, 2021
2 parents 62b36bc + 070c7f5 commit e6e9272
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
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
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";

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

0 comments on commit e6e9272

Please sign in to comment.