From 0f3b8dcf1a41063453b6b3df2a434f27a2af59f6 Mon Sep 17 00:00:00 2001 From: mayeut Date: Thu, 23 Jun 2022 21:46:04 +0200 Subject: [PATCH] f --- .github/workflows/test-pypy.yml | 2 +- .github/workflows/test-python.yml | 2 +- README.md | 8 ++++---- action.yml | 6 +++--- dist/setup/index.js | 14 +++++++------- src/find-pypy.ts | 4 ++-- src/find-python.ts | 4 ++-- src/setup-python.ts | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml index dfad3b999..e4a53bb2f 100644 --- a/.github/workflows/test-pypy.yml +++ b/.github/workflows/test-pypy.yml @@ -84,7 +84,7 @@ jobs: uses: ./ with: python-version: ${{ matrix.pypy }} - no-environment-update: true + update-environment: false - name: PyPy and Python version run: ${{ steps.setup-python.outputs.python-path }} --version diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index ec07ab3dc..17709ec59 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -165,7 +165,7 @@ jobs: uses: ./ with: python-version: ${{ matrix.python }} - no-environment-update: true + update-environment: false - name: Python version run: ${{ steps.setup-python.outputs.python-path }} --version diff --git a/README.md b/README.md index c92b4196d..5adb2033a 100644 --- a/README.md +++ b/README.md @@ -320,12 +320,12 @@ steps: - run: pipenv install ``` -# No environment update +# Environment variables - The `no-environment-update` flag defaults to `false`. + The `update-environment` flag defaults to `true`. With this setting, the action will add/update environment variables (e.g. `PATH`, `PKG_CONFIG_PATH`, `pythonLocation`) for `python` to just work out of the box. - If `no-environment-update` is set to `true`, the action will not add/update environment variables. + If `update-environment` is set to `false`, the action will not add/update environment variables. This can prove useful if you want the only side-effect to be to ensure python is installed and rely on the `python-path` output to run python. Such a requirement on side-effect could be because you don't want your composite action messing with your user's workflows. @@ -336,7 +336,7 @@ steps: id: cp310 with: python-version: '3.10' - no-environment-update: true + update-environment: false - run: ${{ steps.cp310.outputs.python-path }} my_script.py ``` diff --git a/action.yml b/action.yml index 3bc4b1e18..de2a4febc 100644 --- a/action.yml +++ b/action.yml @@ -17,9 +17,9 @@ inputs: default: ${{ github.token }} cache-dependency-path: description: 'Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies.' - no-environment-update: - description: 'Set this option if you want the action not to update environment variables.' - default: false + update-environment: + description: 'Set this option if you want the action to update environment variables.' + default: true outputs: python-version: description: "The installed python version. Useful when given a version range as input." diff --git a/dist/setup/index.js b/dist/setup/index.js index 4f09f0e3c..cdd0f7063 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63865,7 +63865,7 @@ const utils_1 = __nccwpck_require__(1314); const semver = __importStar(__nccwpck_require__(1383)); const core = __importStar(__nccwpck_require__(2186)); const tc = __importStar(__nccwpck_require__(7784)); -function findPyPyVersion(versionSpec, architecture, envUpdate) { +function findPyPyVersion(versionSpec, architecture, updateEnvironment) { return __awaiter(this, void 0, void 0, function* () { let resolvedPyPyVersion = ''; let resolvedPythonVersion = ''; @@ -63884,7 +63884,7 @@ function findPyPyVersion(versionSpec, architecture, envUpdate) { const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : ''; const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`); const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir); - if (envUpdate) { + if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); core.addPath(pythonLocation); @@ -64021,7 +64021,7 @@ function binDir(installDir) { return path.join(installDir, 'bin'); } } -function useCpythonVersion(version, architecture, envUpdate) { +function useCpythonVersion(version, architecture, updateEnvironment) { return __awaiter(this, void 0, void 0, function* () { const desugaredVersionSpec = desugarDevVersion(version); const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec); @@ -64045,7 +64045,7 @@ function useCpythonVersion(version, architecture, envUpdate) { const _binDir = binDir(installDir); const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : ''; const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`); - if (envUpdate) { + if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); if (utils_1.IS_LINUX) { @@ -64471,14 +64471,14 @@ function run() { if (version) { let pythonVersion; const arch = core.getInput('architecture') || os.arch(); - const updateEnv = !core.getBooleanInput('no-environment-update'); + const updateEnvironment = core.getBooleanInput('update-environment'); if (isPyPyVersion(version)) { - const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnv); + const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment); pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`; core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`); } else { - const installed = yield finder.useCpythonVersion(version, arch, updateEnv); + const installed = yield finder.useCpythonVersion(version, arch, updateEnvironment); pythonVersion = installed.version; core.info(`Successfully set up ${installed.impl} (${pythonVersion})`); } diff --git a/src/find-pypy.ts b/src/find-pypy.ts index 0b6f711bd..a19496293 100644 --- a/src/find-pypy.ts +++ b/src/find-pypy.ts @@ -21,7 +21,7 @@ interface IPyPyVersionSpec { export async function findPyPyVersion( versionSpec: string, architecture: string, - envUpdate: boolean + updateEnvironment: boolean ): Promise<{resolvedPyPyVersion: string; resolvedPythonVersion: string}> { let resolvedPyPyVersion = ''; let resolvedPythonVersion = ''; @@ -55,7 +55,7 @@ export async function findPyPyVersion( `python${binaryExtension}` ); const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir); - if (envUpdate) { + if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); core.addPath(pythonLocation); diff --git a/src/find-python.ts b/src/find-python.ts index 02464a42c..967596060 100644 --- a/src/find-python.ts +++ b/src/find-python.ts @@ -33,7 +33,7 @@ function binDir(installDir: string): string { export async function useCpythonVersion( version: string, architecture: string, - envUpdate: boolean + updateEnvironment: boolean ): Promise { const desugaredVersionSpec = desugarDevVersion(version); const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec); @@ -76,7 +76,7 @@ export async function useCpythonVersion( IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}` ); - if (envUpdate) { + if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); diff --git a/src/setup-python.ts b/src/setup-python.ts index ddbc0708a..a7728714d 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -64,12 +64,12 @@ async function run() { if (version) { let pythonVersion: string; const arch: string = core.getInput('architecture') || os.arch(); - const updateEnv = !core.getBooleanInput('no-environment-update'); + const updateEnvironment = core.getBooleanInput('update-environment'); if (isPyPyVersion(version)) { const installed = await finderPyPy.findPyPyVersion( version, arch, - updateEnv + updateEnvironment ); pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`; core.info( @@ -79,7 +79,7 @@ async function run() { const installed = await finder.useCpythonVersion( version, arch, - updateEnv + updateEnvironment ); pythonVersion = installed.version; core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);