Template
1
0
mirror of https://github.com/aminya/setup-cpp synced 2024-11-30 21:22:30 +08:00
setup-cpp/dist/actions_python.a7308daa.js

3 lines
1.2 MiB
JavaScript
Raw Normal View History

2022-05-21 09:32:41 +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})}var t=require("path"),i=require("fs"),o=require("os"),s=require("util"),r=require("assert"),n=require("crypto"),p=require("url"),d=require("buffer"),l=require("stream"),m=require("http"),c=require("https"),u=require("punycode"),h=require("zlib"),g=require("events"),f=require("timers"),y=require("string_decoder"),v=require("child_process"),x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},b=x.parcelRequire810d;b.register("apy8x",((o,s)=>{async function r(a,o,s){var r;if((null===(r=process.env.AGENT_TOOLSDIRECTORY)||void 0===r?void 0:r.trim())?(l.debug("Python is expected to be installed into AGENT_TOOLSDIRECTORY="+process.env.AGENT_TOOLSDIRECTORY),process.env.RUNNER_TOOL_CACHE=process.env.AGENT_TOOLSDIRECTORY):l.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 p.findPyPyVersion(a,s);e=`${t.resolvedPyPyVersion}-${t.resolvedPythonVersion}`,d.info(`Successfully setup PyPy ${t.resolvedPyPyVersion} with Python (${t.resolvedPythonVersion})`)}else{const t=await n.useCpythonVersion(a,s);e=t.version,d.info(`Successfully setup ${t.impl} (${e})`)}const t="pip";await c.cacheDependencies(t,e)}m.isGitHubCI()&&(()=>{const a=e(t).join(u,"python_matcher.json");if(!i.existsSync(a))return d.warning("the python_matcher.json file does not exist in the same folder as setup_cpp.js");d.info("::add-matcher::"+a)})()}a(o.exports,"setupActionsPython",(()=>r));var n=b("kuiAY"),p=b("aqDyC"),d=b("ditiY"),l=b("iQ0s7"),m=b("di6NI"),c=b("hWk6h"),u=t.resolve(__dirname,"../src/python")})),b.register("kuiAY",((e,i)=>{async function s(e,a){const i=((s=e).endsWith("-dev")?`>= ${s.slice(0,-4)}.0-a0`:s).replace(/(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g,"$1-$2");var s;d.debug(`Semantic version spec of ${e} is ${i}`);let m=l.find("Python",i,a);if(!m){d.info(`Version ${i} was not found in the local cache`);const e=await p.findReleaseFromManifest(i,a);e&&e.files&&e.files.length>0&&(d.info(`Version ${i} is available for downloading`),await p.installCpythonFromRelease(e),m=l.find("Python",i,a))}if(!m)throw Error([`Version ${e} with arch ${a} not found`,"The list of all available versions can be found here: "+p.MANIFEST_URL].join(o.EOL));if(d.exportVariable("pythonLocation",m),r.IS_LINUX){const e=process.env.LD_LIBRARY_PATH?":"+process.env.LD_LIBRARY_PATH:"",a=t.join(m,"lib");e.split(":").includes(a)||d.exportVariable("LD_LIBRARY_PATH",a+e)}if(d.addPath(m),d.addPath((e=>t.join(e,r.IS_WINDOWS?"Scripts":"bin"))(m)),r.IS_WINDOWS){const e=t.basename(t.dirname(m)),a=n.major(e),i=n.minor(e),o=t.join(process.env.APPDATA||"","Python",`Python${a}${i}`,"Scripts");d.addPath(o)}const c=(e=>{const a=e.split(t.sep),i=a.findIndex((e=>"PyPy"===e||"Python"===e));return a[i+1]||""})(m);return d.setOutput("python-version",c),{impl:"CPython",version:c}}a(e.exports,"useCpythonVersion",(()=>s));var r=b("3Mp5H"),n=b("4URNm"),p=b("hS2PU"),d=b("iQ0s7"),l=b("1GQ3N")})),b.register("3Mp5H",((o,s)=>{function r(a,o,s,r=!1){const n=t.join(a,o),p=t.join(a,s);e(i).existsSync(p)||(e(i).symlinkSync(n,p),!v&&r&&e(i).chmodSync(p,"755"))}function n(e){return p(e)||!!y.validRange(e)}function p(e){return"nightly"===e}function d(e){return t.basename(t.dirname(e))}function l(a){let o="",s=t.join(a,k);return e(i).existsSync(s)&&(o=""+e(i).readFileSync(s)),o}function m(a,o){const s=t.join(a,k);e(i).writeFileSync(s,o)}function c(e){return/^\d+\.\d+$/.test(e)}function u(){return"GITHUB.COM"!==new URL(process.env.GITHUB_SERVER_URL||"https://github.com").hostname.toUpperCase()}function h(){if(!g.isFeatureAvailable()){if(u())throw Error("Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.");return f.warning("The runner was not able to contact the cache service. Caching will be skipped"
//# sourceMappingURL=actions_python.a7308daa.js.map