setup-cpp/dist/node12/actions_python.cb0a8b6a.js

2 lines
1.3 MiB
JavaScript
Raw Normal View History

2023-04-23 21:44:34 +08:00
function e(e,t,a,i){Object.defineProperty(e,t,{get:a,set:i,enumerable:!0,configurable:!0});}function t(e){return e&&e.__esModule?e.default:e;}var a=require("path"),i=require("os"),r=require("fs"),s=require("util"),o=require("assert"),n=require("crypto"),p=require("url"),d=require("buffer"),l=require("stream"),c=require("events"),m=require("timers"),u=require("string_decoder"),h=require("http"),f=require("https"),g=require("zlib"),y=require("punycode"),x=require("child_process"),v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},b=v.parcelRequire810d;b.register("gN3Li",(t,i)=>{async function r(e,t,a){var i;c.IS_MAC&&(process.env.AGENT_TOOLSDIRECTORY="/Users/runner/hostedtoolcache");const r=null===(i=process.env.AGENT_TOOLSDIRECTORY)||void 0===i?void 0:i.trim();if("string"==typeof r&&""!==r&&(process.env.RUNNER_TOOL_CACHE=process.env.AGENT_TOOLSDIRECTORY),(0,p.debug)("Python is expected to be installed into "+process.env.RUNNER_TOOL_CACHE),e){let t;if(e.startsWith("pypy")){const i=await(0,o.findPyPyVersion)(e,a,!0,f,!1);t=`${i.resolvedPyPyVersion}-${i.resolvedPythonVersion}`,(0,n.info)(`Successfully set up PyPy ${i.resolvedPyPyVersion} with Python (${i.resolvedPythonVersion})`);}else{const i=await(0,s.useCpythonVersion)(e,a,!0,f,!1);t=i.version,(0,n.info)(`Successfully set up ${i.impl} (${t})`);}if((0,c.isCacheFeatureAvailable)()){const e="pip";await(async(e,t)=>{const a=(0,m.getCacheDistributor)(e,t,void 0);await a.restoreCache();})(e,t);}}l.GITHUB_ACTIONS&&(await(async()=>{const e=(0,d.join)(h,"python_matcher.json");if(!(await(0,u.pathExists)(e)))return(0,n.warning)("the python_matcher.json file does not exist in the same folder as setup-cpp.js");(0,n.info)("::add-matcher::"+e);})());}e(t.exports,"setupActionsPython",()=>r);var s=b("kll7s"),o=b("krpgQ"),n=b("78ze2"),p=b("2GhAz"),d=b("hE1s9"),l=b("bu6bR"),c=b("8FjG8"),m=b("7OqSY"),u=b("9Z0Ky"),h=a.resolve(__dirname,"../../src/python");const f=!1;}),b.register("kll7s",(t,r)=>{async function s(e,t,r,s,c){let m=null,u=((e,t)=>{let a=e.replace(/(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g,"$1-$2");return t&&(a=a.replace(/^(\d+)\.(\d+)$/,"~$1.$2.0-0")),a;})(e.replace(/^(\d+)\.(\d+)-dev$/,"~$1.$2.0-0"),c);if(d.debug(`Semantic version spec of ${e} is ${u}`),s){var h;m=await p.getManifest();const e=null===(h=await p.findReleaseFromManifest(u,t,m))||void 0===h?void 0:h.version;e?(u=e,d.info(`Resolved as '${u}'`)):d.info(`Failed to resolve version ${u} from manifest`);}let f=l.find("Python",u,t);if(!f){d.info(`Version ${u} was not found in the local cache`);const e=await p.findReleaseFromManifest(u,t,m);e&&e.files&&e.files.length>0&&(d.info(`Version ${u} is available for downloading`),await p.installCpythonFromRelease(e),f=l.find("Python",u,t));}if(!f){const a=await(0,o.getOSInfo)();throw Error([`The version '${e}' with architecture '${t}' was not found for ${a?`${a.osName} ${a.osVersion}`:"this operating system"}.`,"The list of all available versions can be found here: "+p.MANIFEST_URL].join(i.EOL));}const g=(e=>a.join(e,o.IS_WINDOWS?"Scripts":"bin"))(f),y=a.join(o.IS_WINDOWS?f:g,"python"+(o.IS_WINDOWS?".exe":""));if(r){if(d.exportVariable("pythonLocation",f),d.exportVariable("PKG_CONFIG_PATH",f+"/lib/pkgconfig"),d.exportVariable("pythonLocation",f),d.exportVariable("Python_ROOT_DIR",f),d.exportVariable("Python2_ROOT_DIR",f),d.exportVariable("Python3_ROOT_DIR",f),d.exportVariable("PKG_CONFIG_PATH",f+"/lib/pkgconfig"),o.IS_LINUX){const e=process.env.LD_LIBRARY_PATH?":"+process.env.LD_LIBRARY_PATH:"",t=a.join(f,"lib");e.split(":").includes(t)||d.exportVariable("LD_LIBRARY_PATH",t+e);}if(d.addPath(f),d.addPath(g),o.IS_WINDOWS){const e=a.basename(a.dirname(f)),t=n.major(e),i=n.minor(e),r=a.join(process.env.APPDATA||"","Python",`Python${t}${i}`,"Scripts");d.addPath(r);}}const x=(e=>{const t=e.split(a.sep),i=t.findIndex(e=>"PyPy"===e||"Python"===e);return t[i+1]||"";})(f);return d.setOutput("python-version",x),d.setOutput("python-path",y),{impl:"CPython",version:x};}e(t.exports,"useCpythonVersion",()=>s);
//# sourceMappingURL=actions_python.cb0a8b6a.js.map