setup-cpp/dist/actions_python.318ba25a.js

3 lines
1.4 MiB
JavaScript
Raw Normal View History

2022-08-19 05:10:06 +08:00
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*as m from"crypto";import c,{URL as u,parse as h}from"url";import*as g from"buffer";import f,*as y from"stream";import b,*as v from"http";import x,*as w from"https";import*as N from"punycode";import k from"zlib";import{StringDecoder as S}from"string_decoder";import*as j from"events";import{setImmediate as C}from"timers";import{execSync as T,exec as _}from"child_process";var P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},E=P.parcelRequire810d;E.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=E("lhZHd"),n=E("epYDv"),p=E("gLXeb"),d=E("5HHA7"),l=E("ywN2f"),m=E("jfRjx"),c=E("20imy"),u=$hwYwi$resolve(__dirname,"../src/python")})),E.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=E("jfRjx"),s=E("dsEdn"),r=E("lDDM5"),n=E("5HHA7"),p=E("8annq")})),E.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"))}function s
//# sourceMappingURL=actions_python.318ba25a.js.map