MCPcopy Index your code
hub / github.com/actions/setup-python / run

Function run

src/setup-python.ts:93–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91}
92
93async function run() {
94 if (IS_MAC) {
95 process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
96 }
97
98 if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
99 process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
100 }
101
102 core.debug(
103 `Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`
104 );
105 try {
106 const versions = resolveVersionInput();
107 const checkLatest = core.getBooleanInput('check-latest');
108 const allowPreReleases = core.getBooleanInput('allow-prereleases');
109 const freethreaded = core.getBooleanInput('freethreaded');
110
111 if (versions.length) {
112 let pythonVersion = '';
113 const arch: string = core.getInput('architecture') || os.arch();
114 const updateEnvironment = core.getBooleanInput('update-environment');
115 core.startGroup('Installed versions');
116 for (const version of versions) {
117 if (isPyPyVersion(version)) {
118 const installed = await finderPyPy.findPyPyVersion(
119 version,
120 arch,
121 updateEnvironment,
122 checkLatest,
123 allowPreReleases
124 );
125 pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
126 core.info(
127 `Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
128 );
129 } else if (isGraalPyVersion(version)) {
130 const installed = await finderGraalPy.findGraalPyVersion(
131 version,
132 arch,
133 updateEnvironment,
134 checkLatest,
135 allowPreReleases
136 );
137 pythonVersion = `${installed}`;
138 core.info(`Successfully set up GraalPy ${installed}`);
139 } else {
140 if (version.startsWith('2')) {
141 core.warning(
142 'The support for python 2.7 was removed on June 19, 2023. Related issue: https://github.com/actions/setup-python/issues/672'
143 );
144 }
145 const installed = await finder.useCpythonVersion(
146 version,
147 arch,
148 updateEnvironment,
149 checkLatest,
150 allowPreReleases,

Callers 1

setup-python.tsFile · 0.70

Calls 6

isCacheFeatureAvailableFunction · 0.90
resolveVersionInputFunction · 0.85
isPyPyVersionFunction · 0.85
isGraalPyVersionFunction · 0.85
cacheDependenciesFunction · 0.85
installPipPackagesFunction · 0.85

Tested by

no test coverage detected