setup-cpp/dist/legacy/actions_python.2c5f2ae4.js

3 lines
96 KiB
JavaScript
Raw Normal View History

2024-08-07 14:51:00 +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 $a2uk8$path=require("path"),$a2uk8$os=require("os"),$a2uk8$fs=require("fs"),$a2uk8$stream=require("stream"),$a2uk8$util=require("util"),$a2uk8$assert=require("assert"),$a2uk8$child_process=require("child_process"),$a2uk8$http=require("http"),$a2uk8$https=require("https"),$parcel$global=globalThis,parcelRequire=$parcel$global.parcelRequire810d,parcelRegister=parcelRequire.register;parcelRegister("apy8x",function(e,t){var r,i,s,n,o,a,h,l,c;function u(e){return e.startsWith("pypy");}async function p(e,t,a){var h;l.IS_MAC&&(process.env.AGENT_TOOLSDIRECTORY="/Users/runner/hostedtoolcache");let c=null===(h=process.env.AGENT_TOOLSDIRECTORY)||void 0===h?void 0:h.trim();if("string"==typeof c&&""!==c&&(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 i=await(0,r.findPyPyVersion)(e,a,!0,d,!1);t=`${i.resolvedPyPyVersion}-${i.resolvedPythonVersion}`,(0,o.info)(`Successfully set up PyPy ${i.resolvedPyPyVersion} with Python (${i.resolvedPythonVersion})`);}else{let r=await(0,i.useCpythonVersion)(e,a,!0,d,!1);t=r.version,(0,o.info)(`Successfully set up ${r.impl} (${t})`);}}n.GITHUB_ACTIONS&&(await f());}async function f(){let e=(0,h.join)(c,"python_matcher.json");if(!(await(0,a.pathExists)(e)))return(0,o.warning)("the python_matcher.json file does not exist in the same folder as setup-cpp.js");(0,o.info)("::add-matcher::"+e);}$parcel$export(e.exports,"setupActionsPython",()=>p),r=parcelRequire("aEFxZ"),i=parcelRequire("22ixg"),s=parcelRequire("d1q4F"),n=parcelRequire("jj6Ot"),o=parcelRequire("pcnv8"),a=parcelRequire("hQXed"),h=parcelRequire("jQPzx"),l=parcelRequire("5Gfru"),c=$a2uk8$path.resolve(__dirname,"../../src/python");let d=!1;}),parcelRegister("aEFxZ",function(e,t){var r,i,s,n,o;async function a(e,t,s,o,a){let c,u,p="",f="",d=l(e);if(o&&(u=await r.getAvailablePyPyVersions())&&u.length>0){let e=r.findRelease(u,d.pythonVersion,d.pypyVersion,t,!1);e?(n.info(`Resolved as PyPy ${e.resolvedPyPyVersion} with Python (${e.resolvedPythonVersion})`),d.pythonVersion=e.resolvedPythonVersion,d.pypyVersion=e.resolvedPyPyVersion):n.info(`Failed to resolve PyPy ${d.pypyVersion} with Python (${d.pythonVersion}) from manifest`);}({installDir:c,resolvedPythonVersion:f,resolvedPyPyVersion:p}=h(d.pythonVersion,d.pypyVersion,t)),c||({installDir:c,resolvedPythonVersion:f,resolvedPyPyVersion:p}=await r.installPyPy(d.pypyVersion,d.pythonVersion,t,a,u));let m=i.IS_WINDOWS?"Scripts":"bin",y=$a2uk8$path.join(c,m),g=i.IS_WINDOWS?".exe":"",E=$a2uk8$path.join(i.IS_WINDOWS?c:y,"python"+g),w=r.getPyPyBinaryPath(c);return s&&(n.exportVariable("pythonLocation",c),n.exportVariable("Python_ROOT_DIR",c),n.exportVariable("Python2_ROOT_DIR",c),n.exportVariable("Python3_ROOT_DIR",c),n.exportVariable("PKG_CONFIG_PATH",w+"/lib/pkgconfig"),n.addPath(w),n.addPath(y)),n.setOutput("python-version","pypy"+p),n.setOutput("python-path",E),{resolvedPyPyVersion:p,resolvedPythonVersion:f};}function h(e,t,r){let a="",h="",l=i.IS_WINDOWS?c(e):o.find("PyPy",e,r);return l&&(h=(0,i.getPyPyVersionFromPath)(l),a=(0,i.readExactPyPyVersionFile)(l),s.satisfies(a,t)||(l=null,a="",h="")),l||n.info(`PyPy version ${e} (${t}) was not found in the local cache`),{installDir:l,resolvedPythonVersion:h,resolvedPyPyVersion:a};}function l(e){let t;let s=e.split("-").filter(e=>!!e);if(/^(pypy)(.+)/.test(s[0])){let e=s[0].replace("pypy","");s.splice(0,1,"pypy",e);}if(s.length<2||"pypy"!=s[0])throw Error("Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy<python-version>' or 'pypy-<python-version>'. See README for examples and documentation.");let n=s[1];if(t=s.length>2?r.pypyVersionToSemantic(s[2]):"x",!(0,i.validateVersion)(n)||!(0,i.validateVersion)(t))throw Error("Invalid 'version' property for PyPy. Both Python version and PyPy versions should satisfy SemVer notation. See READ
`,t&&t.split){let i=t.split(/\n/),s=(Math.min(i.length,e.line+3)+"").length,n=" ";for(;n.length<s;)n+=" ";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<s&&(o=" "+o),e.line===t){r+=o+"> "+i[t]+"\n"+n+" ";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("2uSzl",function(e,t){var r,i;function s(e,t){function s(t,r,n,o){if(t>=e.length)try{return n(a.finish());}catch(t){return o(i(t,e));}try{a.parse(e.slice(t,t+r)),setImmediate(s,t+r,r,n,o);}catch(t){o(i(t,e));}}t||(t={});let n=0,o=t.blocksize||40960,a=new r();return new Promise((e,t)=>{setImmediate(s,n,o,e,t);});}e.exports=s,r=parcelRequire("b2xMG"),i=parcelRequire("dJNLp");}),parcelRegister("KqXNC",function(e,t){var r;function i(e){return e?s(e):n(e);}function s(e){let t=new r();return e.setEncoding("utf8"),new Promise((r,i)=>{let s;function n(){if(h=!0,!s)try{r(t.finish());}catch(e){i(e);}}function o(e){l=!0,i(e);}function a(){let r;for(s=!0;null!==(r=e.read());)try{t.parse(r);}catch(e){return o(e);}if(s=!1,h)return n();l||e.once("readable",a);}let h=!1,l=!1;e.once("end",n),e.once("error",o),a();});}function n(){let e=new r();return new $a2uk8$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("b2xMG");}),parcelRegister("b0nti",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=c(e);if("table"!==t)throw i(t);return h("","",e);}function i(e){return Error("Can only stringify objects, not "+e);}function s(){return Error("Array values can't have mixed types");}function n(e){return Object.keys(e).filter(t=>l(e[t]));}function o(e){return Object.keys(e).filter(t=>!l(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=n(r=a(r)),s=o(r);var i,s,h=[],l=t||"";i.forEach(e=>{var t=c(r[e]);"undefined"!==t&&"null"!==t&&h.push(l+u(e)+" = "+g(r[e],!0));}),h.length>0&&h.push("");var p=e&&i.length>0?t+" ":"";return s.forEach(t=>{h.push(T(e,p,t,r[t]));}),h.join("\n");}function l(e){switch(c(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"!==c(e[0]);case"table":return 0===Object.keys(e).length;default:return!1;}}function c(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 g(e,t){let r=c(e);return"string"===r&&(t&&/\n/.test(e)?r="string-multiline":!/[\b\t\n\f\r']/.test(e)&&/"/.test(e)&&(r="string-literal")),E(e,r);}function E(e,t){switch(t||(t=c(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 O(e
//# sourceMappingURL=actions_python.2c5f2ae4.js.map