setup-cpp/dist/legacy/actions_python.c7411d6b.js

3 lines
87 KiB
JavaScript
Raw Normal View History

2024-01-22 15:34:53 +08:00
function $parcel$export(e,t,r,i){Object.defineProperty(e,t,{get:r,set:i,enumerable:!0,configurable:!0});}function $parcel$interopDefault(e){return e&&e.__esModule?e.default:e;}var $kC5q1$path=require("path"),$kC5q1$os=require("os"),$kC5q1$fs=require("fs"),$kC5q1$stream=require("stream"),$kC5q1$util=require("util"),$kC5q1$assert=require("assert"),$kC5q1$child_process=require("child_process"),$kC5q1$crypto=require("crypto"),$parcel$global=globalThis,parcelRequire=$parcel$global.parcelRequire810d,parcelRegister=parcelRequire.register;parcelRegister("8L9T2",function(e,t){var r,i,n,s,o,a,h,c,l;function u(e){return e.startsWith("pypy");}async function p(e,t,o){var c;h.IS_MAC&&(process.env.AGENT_TOOLSDIRECTORY="/Users/runner/hostedtoolcache");let l=null===(c=process.env.AGENT_TOOLSDIRECTORY)||void 0===c?void 0:c.trim();if("string"==typeof l&&""!==l&&(process.env.RUNNER_TOOL_CACHE=process.env.AGENT_TOOLSDIRECTORY),(0,s.debug)("Python is expected to be installed into "+process.env.RUNNER_TOOL_CACHE),e){let t;if(u(e)){let r=await(0,i.findPyPyVersion)(e,o,!0,d,!1);t=`${r.resolvedPyPyVersion}-${r.resolvedPythonVersion}`,(0,n.info)(`Successfully set up PyPy ${r.resolvedPyPyVersion} with Python (${r.resolvedPythonVersion})`);}else{let i=await(0,r.useCpythonVersion)(e,o,!0,d,!1);t=i.version,(0,n.info)(`Successfully set up ${i.impl} (${t})`);}}a.GITHUB_ACTIONS&&(await f());}async function f(){let e=(0,o.join)(l,"python_matcher.json");if(!(await(0,c.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);}$parcel$export(e.exports,"setupActionsPython",()=>p),r=parcelRequire("i8mEC"),i=parcelRequire("ktIgk"),n=parcelRequire("hHq4F"),s=parcelRequire("1o3Gj"),o=parcelRequire("eAXk4"),a=parcelRequire("dAuy6"),h=parcelRequire("56hu0"),c=parcelRequire("6t4SD"),l=$kC5q1$path.resolve(__dirname,"../../src/python");let d=!1;}),parcelRegister("i8mEC",function(e,t){var r,i,n,s,o;function a(e){return r.IS_WINDOWS?$kC5q1$path.join(e,"Scripts"):$kC5q1$path.join(e,"bin");}async function h(e,t,h,p,f){let d=null,m=u(c(e),f);if(s.debug(`Semantic version spec of ${e} is ${m}`),p){var y;d=await n.getManifest();let e=null===(y=await n.findReleaseFromManifest(m,t,d))||void 0===y?void 0:y.version;e?(m=e,s.info(`Resolved as '${m}'`)):s.info(`Failed to resolve version ${m} from manifest`);}let E=o.find("Python",m,t);if(!E){s.info(`Version ${m} was not found in the local cache`);let e=await n.findReleaseFromManifest(m,t,d);e&&e.files&&e.files.length>0&&(s.info(`Version ${m} is available for downloading`),await n.installCpythonFromRelease(e),E=o.find("Python",m,t));}if(!E){let i=await(0,r.getOSInfo)();throw Error([`The version '${e}' with architecture '${t}' was not found for ${i?`${i.osName} ${i.osVersion}`:"this operating system"}.`,"The list of all available versions can be found here: "+n.MANIFEST_URL].join($kC5q1$os.EOL));}let g=a(E),w=r.IS_WINDOWS?".exe":"",x=$kC5q1$path.join(r.IS_WINDOWS?E:g,"python"+w);if(h){if(s.exportVariable("pythonLocation",E),s.exportVariable("PKG_CONFIG_PATH",E+"/lib/pkgconfig"),s.exportVariable("pythonLocation",E),s.exportVariable("Python_ROOT_DIR",E),s.exportVariable("Python2_ROOT_DIR",E),s.exportVariable("Python3_ROOT_DIR",E),s.exportVariable("PKG_CONFIG_PATH",E+"/lib/pkgconfig"),r.IS_LINUX){let e=process.env.LD_LIBRARY_PATH?":"+process.env.LD_LIBRARY_PATH:"",t=$kC5q1$path.join(E,"lib");e.split(":").includes(t)||s.exportVariable("LD_LIBRARY_PATH",t+e);}if(s.addPath(E),s.addPath(g),r.IS_WINDOWS){let e=$kC5q1$path.basename($kC5q1$path.dirname(E)),t=i.major(e),r=i.minor(e),n=$kC5q1$path.join(process.env.APPDATA||"","Python",`Python${t}${r}`,"Scripts");s.addPath(n);}}let v=l(E);return s.setOutput("python-version",v),s.setOutput("python-path",x),{impl:"CPython",version:v};}function c(e){let t=/^(\d+)\.(\d+)-dev$/;return e.replace(t,"~$1.$2.0-0");}function l(e){let t=e.split($kC5q1$path.sep),r=t.findIndex(e=>"PyPy"===e||"Python"===e);return t[r+1]||"";}function u(e,t){let r=/(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g,i=/^(\d+)\.(\d+)$/,n=e.replace(r,"$1-$
`,t&&t.split){let i=t.split(/\n/),n=(Math.min(i.length,e.line+3)+"").length,s=" ";for(;s.length<n;)s+=" ";for(let t=Math.max(0,e.line-1);t<Math.min(i.length,e.line+2);++t){let o=t+1+"";if(o.length<n&&(o=" "+o),e.line===t){r+=o+"> "+i[t]+"\n"+s+" ";for(let t=0;t<e.col;++t)r+=" ";r+="^\n";}else r+=o+": "+i[t]+"\n";}}return e.message=r+"\n",e;}e.exports=r;}),parcelRegister("cn5IV",function(e,t){var r,i;function n(e,t){function n(t,r,s,o){if(t>=e.length)try{return s(a.finish());}catch(t){return o(i(t,e));}try{a.parse(e.slice(t,t+r)),setImmediate(n,t+r,r,s,o);}catch(t){o(i(t,e));}}t||(t={});let s=0,o=t.blocksize||40960,a=new r();return new Promise((e,t)=>{setImmediate(n,s,o,e,t);});}e.exports=n,r=parcelRequire("kdMBf"),i=parcelRequire("2Aiv1");}),parcelRegister("6Gy5N",function(e,t){var r;function i(e){return e?n(e):s(e);}function n(e){let t=new r();return e.setEncoding("utf8"),new Promise((r,i)=>{let n;function s(){if(h=!0,!n)try{r(t.finish());}catch(e){i(e);}}function o(e){c=!0,i(e);}function a(){let r;for(n=!0;null!==(r=e.read());)try{t.parse(r);}catch(e){return o(e);}if(n=!1,h)return s();c||e.once("readable",a);}let h=!1,c=!1;e.once("end",s),e.once("error",o),a();});}function s(){let e=new r();return new $kC5q1$stream.Transform({objectMode:!0,transform(t,r,i){try{e.parse(t.toString(r));}catch(e){this.emit("error",e);}i();},flush(t){try{this.push(e.finish());}catch(e){this.emit("error",e);}t();}});}e.exports=i,r=parcelRequire("kdMBf");}),parcelRegister("AMirQ",function(e,t){function r(e){if(null===e)throw i("null");if(void 0===e)throw i("undefined");if("object"!=typeof e)throw i(typeof e);if("function"==typeof e.toJSON&&(e=e.toJSON()),null==e)return null;let t=l(e);if("table"!==t)throw i(t);return h("","",e);}function i(e){return Error("Can only stringify objects, not "+e);}function n(){return Error("Array values can't have mixed types");}function s(e){return Object.keys(e).filter(t=>c(e[t]));}function o(e){return Object.keys(e).filter(t=>!c(e[t]));}function a(e){let t=Array.isArray(e)?[]:Object.prototype.hasOwnProperty.call(e,"__proto__")?{["__proto__"]:void 0}:{};for(let r of Object.keys(e))!e[r]||"function"!=typeof e[r].toJSON||"toISOString"in e[r]?t[r]=e[r]:t[r]=e[r].toJSON();return t;}function h(e,t,r){i=s(r=a(r)),n=o(r);var i,n,h=[],c=t||"";i.forEach(e=>{var t=l(r[e]);"undefined"!==t&&"null"!==t&&h.push(c+u(e)+" = "+E(r[e],!0));}),h.length>0&&h.push("");var p=e&&i.length>0?t+" ":"";return n.forEach(t=>{h.push(R(e,p,t,r[t]));}),h.join("\n");}function c(e){switch(l(e)){case"undefined":case"null":case"integer":case"nan":case"float":case"boolean":case"string":case"datetime":return!0;case"array":return 0===e.length||"table"!==l(e[0]);case"table":return 0===Object.keys(e).length;default:return!1;}}function l(e){if(void 0===e)return"undefined";if(null===e)return"null";if("bigint"==typeof e||Number.isInteger(e)&&!Object.is(e,-0))return"integer";if("number"==typeof e)return"float";if("boolean"==typeof e)return"boolean";else if("string"==typeof e)return"string";else if("toISOString"in e)return isNaN(e)?"undefined":"datetime";else if(Array.isArray(e))return"array";else return"table";}function u(e){var t=e+"";return /^[-A-Za-z0-9_]+$/.test(t)?t:p(t);}function p(e){return'"'+m(e).replace(/"/g,'\\"')+'"';}function f(e){return"'"+e+"'";}function d(e,t){for(;t.length<e;)t="0"+t;return t;}function m(e){return e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/([\u0000-\u001f\u007f])/,e=>"\\u"+d(4,e.codePointAt(0).toString(16)));}function y(e){let t=e.split(/\n/).map(e=>m(e).replace(/"(?="")/g,'\\"')).join("\n");return'"'===t.slice(-1)&&(t+="\\\n"),'"""\n'+t+'"""';}function E(e,t){let r=l(e);return"string"===r&&(t&&/\n/.test(e)?r="string-multiline":!/[\b\t\n\f\r']/.test(e)&&/"/.test(e)&&(r="string-literal")),g(e,r);}function g(e,t){switch(t||(t=l(e)),t){case"string-multiline":return y(e);case"string":return p(e);case"string-literal":return f(e);case"integer":return w(e);case"float":return x(e);case"boolean":return v(e);case"datetime":return I(e
//# sourceMappingURL=actions_python.c7411d6b.js.map