setup-cpp/dist/actions_python.dfab21e0.js

3 lines
1.4 MiB
JavaScript
Raw Normal View History

function e(e){return e&&e.__esModule?e.default:e}function a(e,a,t,i){Object.defineProperty(e,a,{get:t,set:i,enumerable:!0,configurable:!0})}import t,*as i from"fs";import o,*as s from"path";import r,*as n from"os";import p,*as d from"util";import*as l from"assert";import m,*as c from"crypto";import u,{URL as h,parse as g}from"url";import*as f from"buffer";import y,*as b from"stream";import v,*as x from"http";import w,*as k from"https";import*as N from"punycode";import S from"zlib";import{StringDecoder as j}from"string_decoder";import*as C from"events";import{setImmediate as T}from"timers";import{execSync as _,exec as P}from"child_process";var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},z=E.parcelRequire810d;z.register("doiKQ",((t,i)=>{async function s(a,t,i){var s;if(m.IS_WINDOWS||(null===(s=process.env.AGENT_TOOLSDIRECTORY)||void 0===s?void 0:s.trim())||(process.env.AGENT_TOOLSDIRECTORY=m.IS_LINUX?"/opt/hostedtoolcache":"/Users/runner/hostedtoolcache",process.env.RUNNER_TOOL_CACHE=process.env.AGENT_TOOLSDIRECTORY),(0,d.debug)("Python is expected to be installed into RUNNER_TOOL_CACHE="+process.env.RUNNER_TOOL_CACHE),a){let e;if(a.startsWith("pypy")){const t=await(0,n.findPyPyVersion)(a,i,!0);e=`${t.resolvedPyPyVersion}-${t.resolvedPythonVersion}`,(0,p.info)(`Successfully set up PyPy ${t.resolvedPyPyVersion} with Python (${t.resolvedPythonVersion})`)}else{const t=await(0,r.useCpythonVersion)(a,i,!0);e=t.version,(0,p.info)(`Successfully set up ${t.impl} (${e})`)}if((0,m.isCacheFeatureAvailable)()){const a="pip";await(async(e,a)=>{const t=(0,c.getCacheDistributor)(e,a,void 0);await t.restoreCache()})(a,e)}}"github-actions"===e(l)()&&(()=>{const e=o.join(u,"python_matcher.json");if(!$hwYwi$existsSync(e))return(0,p.warning)("the python_matcher.json file does not exist in the same folder as setup_cpp.js");(0,p.info)("::add-matcher::"+e)})()}a(t.exports,"setupActionsPython",(()=>s));var r=z("lhZHd"),n=z("epYDv"),p=z("81ovw"),d=z("gF2Jd"),l=z("ywN2f"),m=z("jfRjx"),c=z("20imy"),u=$hwYwi$resolve(__dirname,"../src/python")})),z.register("lhZHd",((e,t)=>{async function i(e,a,t){const i=e.replace(/^(\d+)\.(\d+)-dev$/,"~$1.$2.0-0").replace(/(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g,"$1-$2");n.debug(`Semantic version spec of ${e} is ${i}`);let d=p.find("Python",i,a);if(!d){n.info(`Version ${i} was not found in the local cache`);const e=await r.findReleaseFromManifest(i,a);e&&e.files&&e.files.length>0&&(n.info(`Version ${i} is available for downloading`),await r.installCpythonFromRelease(e),d=p.find("Python",i,a))}if(!d)throw Error([`Version ${e} with arch ${a} not found`,"The list of all available versions can be found here: "+r.MANIFEST_URL].join($hwYwi$EOL));const l=(e=>o.IS_WINDOWS?$hwYwi$join(e,"Scripts"):$hwYwi$join(e,"bin"))(d),m=$hwYwi$join(o.IS_WINDOWS?d:l,"python"+(o.IS_WINDOWS?".exe":""));if(t){if(n.exportVariable("pythonLocation",d),n.exportVariable("PKG_CONFIG_PATH",d+"/lib/pkgconfig"),n.exportVariable("pythonLocation",d),n.exportVariable("Python_ROOT_DIR",d),n.exportVariable("Python2_ROOT_DIR",d),n.exportVariable("Python3_ROOT_DIR",d),n.exportVariable("PKG_CONFIG_PATH",d+"/lib/pkgconfig"),o.IS_LINUX){const e=process.env.LD_LIBRARY_PATH?":"+process.env.LD_LIBRARY_PATH:"",a=$hwYwi$join(d,"lib");e.split(":").includes(a)||n.exportVariable("LD_LIBRARY_PATH",a+e)}if(n.addPath(d),n.addPath(l),o.IS_WINDOWS){const e=$hwYwi$basename($hwYwi$dirname(d)),a=s.major(e),t=s.minor(e),i=$hwYwi$join(process.env.APPDATA||"","Python",`Python${a}${t}`,"Scripts");n.addPath(i)}}const c=(e=>{const a=e.split($hwYwi$sep),t=a.findIndex((e=>"PyPy"===e||"Python"===e));return a[t+1]||""})(d);return n.setOutput("python-version",c),n.setOutput("python-path",m),{impl:"CPython",version:c}}a(e.exports,"useCpythonVersion",(()=>i));var o=z("jfRjx"),s=z("dsEdn"),r=z("lDDM5"),n=z("gF2Jd"),p=z("8annq")})),z.register("jfRjx",((e,i)=>{function o(e,a,i,o=!1){const s=$hwYwi$join(e,a),r=$hwYwi$join(e,i);t.existsSync(r)||(t.symlinkSync(s,r),!f&&o&&t.chmodSync(r,"755"))}functio
//# sourceMappingURL=actions_python.dfab21e0.js.map