setup-cpp/dist/node16/actions_python.7a37fdc4.js

6 lines
1.3 MiB
JavaScript
Raw Normal View History

2023-07-16 05:33:37 +08:00
var e=require("path"),t=require("os"),i=require("fs"),r=require("util"),a=require("assert"),n=require("crypto"),o=require("url"),s=require("buffer"),u=require("stream"),c=require("events"),l=require("timers"),p=require("string_decoder"),d=require("http"),m=require("https"),x=require("zlib"),h=require("child_process");function f(e,t,i,r){Object.defineProperty(e,t,{get:i,set:r,enumerable:!0,configurable:!0});}function g(e){return e&&e.__esModule?e.default:e;}var D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},y=D.parcelRequire810d;y.register("gaT4u",function(t,i){f(t.exports,"setupActionsPython",()=>x);var r=y("aFFO5"),a=y("6hNjn"),n=y("flyTv"),o=y("4FWaQ"),s=y("eN8ZM"),u=y("6ayHM"),c=y("83PmT"),l=y("iZKPU"),p=y("4DnxS"),d=e.resolve(__dirname,"../../src/python");async function m(e,t){let i=(0,l.getCacheDistributor)(e,t,void 0);await i.restoreCache();}async function x(e,t,i){c.IS_MAC&&(process.env.AGENT_TOOLSDIRECTORY="/Users/runner/hostedtoolcache");let s=process.env.AGENT_TOOLSDIRECTORY?.trim();if("string"==typeof s&&""!==s&&(process.env.RUNNER_TOOL_CACHE=process.env.AGENT_TOOLSDIRECTORY),(0,o.debug)(`Python is expected to be installed into ${process.env.RUNNER_TOOL_CACHE}`),e){let t;if(e.startsWith("pypy")){let r=await(0,a.findPyPyVersion)(e,i,!0,!1,!1);t=`${r.resolvedPyPyVersion}-${r.resolvedPythonVersion}`,(0,n.info)(`Successfully set up PyPy ${r.resolvedPyPyVersion} with Python (${r.resolvedPythonVersion})`);}else{let a=await(0,r.useCpythonVersion)(e,i,!0,!1,!1);t=a.version,(0,n.info)(`Successfully set up ${a.impl} (${t})`);}(0,c.isCacheFeatureAvailable)()&&(await m("pip",t));}u.GITHUB_ACTIONS&&(await h());}async function h(){let e=(0,s.join)(d,"python_matcher.json");if(!(await(0,p.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}`);}}),y.register("aFFO5",function(i,r){f(i.exports,"useCpythonVersion",()=>c);var a=y("83PmT"),n=y("jk5zi"),o=y("bB6Rv"),s=y("4FWaQ"),u=y("6AQw7");async function c(i,r,c,l,p){var d;let m;let x=null,h=i.replace(/^(\d+)\.(\d+)-dev$/,"~$1.$2.0-0"),f=(m=h.replace(/(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g,"$1-$2"),p&&(m=m.replace(/^(\d+)\.(\d+)$/,"~$1.$2.0-0")),m);if(s.debug(`Semantic version spec of ${i} is ${f}`),l){x=await o.getManifest();let e=(await o.findReleaseFromManifest(f,r,x))?.version;e?(f=e,s.info(`Resolved as '${f}'`)):s.info(`Failed to resolve version ${f} from manifest`);}let g=u.find("Python",f,r);if(!g){s.info(`Version ${f} was not found in the local cache`);let e=await o.findReleaseFromManifest(f,r,x);e&&e.files&&e.files.length>0&&(s.info(`Version ${f} is available for downloading`),await o.installCpythonFromRelease(e),g=u.find("Python",f,r));}if(!g){let e=await(0,a.getOSInfo)();throw Error([`The version '${i}' with architecture '${r}' was not found for ${e?`${e.osName} ${e.osVersion}`:"this operating system"}.`,`The list of all available versions can be found here: ${o.MANIFEST_URL}`].join(t.EOL));}let D=(d=g,a.IS_WINDOWS?e.join(d,"Scripts"):e.join(d,"bin")),y=a.IS_WINDOWS?".exe":"",b=e.join(a.IS_WINDOWS?g:D,`python${y}`);if(c){if(s.exportVariable("pythonLocation",g),s.exportVariable("PKG_CONFIG_PATH",g+"/lib/pkgconfig"),s.exportVariable("pythonLocation",g),s.exportVariable("Python_ROOT_DIR",g),s.exportVariable("Python2_ROOT_DIR",g),s.exportVariable("Python3_ROOT_DIR",g),s.exportVariable("PKG_CONFIG_PATH",g+"/lib/pkgconfig"),a.IS_LINUX){let t=process.env.LD_LIBRARY_PATH?`:${process.env.LD_LIBRARY_PATH}`:"",i=e.join(g,"lib");t.split(":").includes(i)||s.exportVariable("LD_LIBRARY_PATH",i+t);}if(s.addPath(g),s.addPath(D),a.IS_WINDOWS){let t=e.basename(e.dirname(g)),i=n.major(t),r=n.minor(t),a=e.join(process.env.APPDATA||"","Python",`Python${i}${r}`,"Scripts");s.addPath(a);}}let v=function(t){let i=t.split(e.sep),r=i.findIndex(e=>"PyPy"===e||"Python"===e);return i[r+1]||"";}(g);return s.setOutput("python-version",v),s.setOutput("python-path",b),{impl:"CPython",version:v};}}),y.register("83PmT",
Other caches with similar key:`),(null==t?void 0:t.artifactCaches)||[]))c.debug(`Cache Key: ${null==r?void 0:r.cacheKey}, Cache Version: ${null==r?void 0:r.cacheVersion}, Cache Scope: ${null==r?void 0:r.scope}, Cache Created: ${null==r?void 0:r.creationTime}`);}});}(e[0],r,a)),null;if(!(0,g.isSuccessStatusCode)(o.statusCode))throw Error(`Cache service responded with ${o.statusCode}`);let s=o.result,l=null==s?void 0:s.archiveLocation;if(!l)throw Error("Cache not found.");return c.setSecret(l),c.debug("Cache Result:"),c.debug(JSON.stringify(s)),s;});},e.exports.downloadCache=function(e,t,i){return u(this,void 0,void 0,function*(){let r=new o.URL(e),a=(0,f.getDownloadOptions)(i);a.useAzureSdk&&r.hostname.endsWith(".blob.core.windows.net")?yield(0,h.downloadCacheStorageSDK)(e,t,a):yield(0,h.downloadCacheHttpClient)(e,t);});},e.exports.reserveCache=function(e,t,i){return u(this,void 0,void 0,function*(){let r=b(),a=v(t,null==i?void 0:i.compressionMethod,null==i?void 0:i.enableCrossOsArchive),n={key:e,version:a,cacheSize:null==i?void 0:i.cacheSize},o=yield(0,g.retryTypedResponse)("reserveCache",()=>u(this,void 0,void 0,function*(){return r.postJson(D("caches"),n);}));return o;});},e.exports.saveCache=function(e,t,i){return u(this,void 0,void 0,function*(){let r=b();c.debug("Upload cache"),yield function(e,t,i,r){return u(this,void 0,void 0,function*(){let a=x.getArchiveFileSizeInBytes(i),n=D(`caches/${t.toString()}`),o=m.openSync(i,"r"),s=(0,f.getUploadOptions)(r),l=x.assertDefined("uploadConcurrency",s.uploadConcurrency),p=x.assertDefined("uploadChunkSize",s.uploadChunkSize),d=[...Array(l).keys()];c.debug("Awaiting all uploads");let h=0;try{yield Promise.all(d.map(()=>u(this,void 0,void 0,function*(){for(;h<a;){let t=Math.min(a-h,p),r=h,s=h+t-1;h+=p,yield function(e,t,i,r,a){return u(this,void 0,void 0,function*(){c.debug(`Uploading chunk of size ${a-r+1} bytes at offset ${r} with content range: ${C(r,a)}`);let n={"Content-Type":"application/octet-stream","Content-Range":C(r,a)},o=yield(0,g.retryHttpClientResponse)(`uploadChunk (start: ${r}, end: ${a})`,()=>u(this,void 0,void 0,function*(){return e.sendStream("PATCH",t,i(),n);}));if(!(0,g.isSuccessStatusCode)(o.message.statusCode))throw Error(`Cache service responded with ${o.message.statusCode} during upload chunk.`);});}(e,n,()=>m.createReadStream(i,{fd:o,start:r,end:s,autoClose:!1}).on("error",e=>{throw Error(`Cache upload failed because file read failed with ${e.message}`);}),r,s);}})));}finally{m.closeSync(o);}});}(r,e,t,i),c.debug("Commiting cache");let a=x.getArchiveFileSizeInBytes(t);c.info(`Cache Size: ~${Math.round(a/1048576)} MB (${a} B)`);let n=yield function(e,t,i){return u(this,void 0,void 0,function*(){let r={size:i};return yield(0,g.retryTypedResponse)("commitCache",()=>u(this,void 0,void 0,function*(){return e.postJson(D(`caches/${t.toString()}`),r);}));});}(r,e,a);if(!(0,g.isSuccessStatusCode)(n.statusCode))throw Error(`Cache service responded with ${n.statusCode} during commit cache.`);c.info("Cache saved successfully");});};}),y.register("aihYA",function(e,t){"use strict";var a=e.exports&&e.exports.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var a=Object.getOwnPropertyDescriptor(t,i);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[i];}}),Object.defineProperty(e,r,a);}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i];}),n=e.exports&&e.exports.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t});}:function(e,t){e.default=t;}),o=e.exports&&e.exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&a(t,e,i);return n(t,e),t;},c=e.exports&&e.exports.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(function(a,n){function o(e){try{u(r.next(e));}catch(e){n(e);}}function s(e){try{u(r.throw(e));}catch(e){n(e);}}function u(e){var t;e.done?a(e.value):((t=e.value)instanceof i?t:new i(function(e){e(t);})).then(o,s);}u((r=r.apply(e,t||[])).
`;}),r;}getCanonicalizedResourceString(e){let t=(0,r.getURLPath)(e.url)||"/",i="";i+=`/${this.factory.accountName}${t}`;let a=(0,r.getURLQueries)(e.url),n={};if(a){let e=[];for(let t in a)if(Object.prototype.hasOwnProperty.call(a,t)){let i=t.toLowerCase();n[i]=a[t],e.push(i);}for(let t of(e.sort(),e))i+=`
${t}:${decodeURIComponent(n[t])}`;}return i;}}}),y.register("dywjo",function(e,t){f(e.exports,"SDK_VERSION",()=>i),f(e.exports,"SERVICE_VERSION",()=>r),f(e.exports,"BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES",()=>a),f(e.exports,"BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES",()=>n),f(e.exports,"BLOCK_BLOB_MAX_BLOCKS",()=>o),f(e.exports,"DEFAULT_BLOCK_BUFFER_SIZE_BYTES",()=>s),f(e.exports,"DEFAULT_BLOB_DOWNLOAD_BLOCK_BYTES",()=>u),f(e.exports,"DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS",()=>c),f(e.exports,"REQUEST_TIMEOUT",()=>l),f(e.exports,"StorageOAuthScopes",()=>p),f(e.exports,"URLConstants",()=>d),f(e.exports,"HeaderConstants",()=>m),f(e.exports,"ETagNone",()=>x),f(e.exports,"ETagAny",()=>h),f(e.exports,"EncryptionAlgorithmAES25",()=>g),f(e.exports,"DevelopmentConnectionString",()=>D),f(e.exports,"StorageBlobLoggingAllowedHeaderNames",()=>y),f(e.exports,"StorageBlobLoggingAllowedQueryParameters",()=>b),f(e.exports,"BlobUsesCustomerSpecifiedEncryptionMsg",()=>v),f(e.exports,"BlobDoesNotUseCustomerSpecifiedEncryption",()=>C),f(e.exports,"PathStylePorts",()=>E);let i="12.14.0",r="2022-11-02",a=268435456,n=4194304e3,o=5e4,s=8388608,u=4194304,c=5,l=1e5,p="https://storage.azure.com/.default",d={Parameters:{FORCE_BROWSER_NO_CACHE:"_",SIGNATURE:"sig",SNAPSHOT:"snapshot",VERSIONID:"versionid",TIMEOUT:"timeout"}},m={AUTHORIZATION:"Authorization",AUTHORIZATION_SCHEME:"Bearer",CONTENT_ENCODING:"Content-Encoding",CONTENT_ID:"Content-ID",CONTENT_LANGUAGE:"Content-Language",CONTENT_LENGTH:"Content-Length",CONTENT_MD5:"Content-Md5",CONTENT_TRANSFER_ENCODING:"Content-Transfer-Encoding",CONTENT_TYPE:"Content-Type",COOKIE:"Cookie",DATE:"date",IF_MATCH:"if-match",IF_MODIFIED_SINCE:"if-modified-since",IF_NONE_MATCH:"if-none-match",IF_UNMODIFIED_SINCE:"if-unmodified-since",PREFIX_FOR_STORAGE:"x-ms-",RANGE:"Range",USER_AGENT:"User-Agent",X_MS_CLIENT_REQUEST_ID:"x-ms-client-request-id",X_MS_COPY_SOURCE:"x-ms-copy-source",X_MS_DATE:"x-ms-date",X_MS_ERROR_CODE:"x-ms-error-code",X_MS_VERSION:"x-ms-version"},x="",h="*",g="AES256",D="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;",y=["Access-Control-Allow-Origin","Cache-Control","Content-Length","Content-Type","Date","Request-Id","traceparent","Transfer-Encoding","User-Agent","x-ms-client-request-id","x-ms-date","x-ms-error-code","x-ms-request-id","x-ms-return-client-request-id","x-ms-version","Accept-Ranges","Content-Disposition","Content-Encoding","Content-Language","Content-MD5","Content-Range","ETag","Last-Modified","Server","Vary","x-ms-content-crc64","x-ms-copy-action","x-ms-copy-completion-time","x-ms-copy-id","x-ms-copy-progress","x-ms-copy-status","x-ms-has-immutability-policy","x-ms-has-legal-hold","x-ms-lease-state","x-ms-lease-status","x-ms-range","x-ms-request-server-encrypted","x-ms-server-encrypted","x-ms-snapshot","x-ms-source-range","If-Match","If-Modified-Since","If-None-Match","If-Unmodified-Since","x-ms-access-tier","x-ms-access-tier-change-time","x-ms-access-tier-inferred","x-ms-account-kind","x-ms-archive-status","x-ms-blob-append-offset","x-ms-blob-cache-control","x-ms-blob-committed-block-count","x-ms-blob-condition-appendpos","x-ms-blob-condition-maxsize","x-ms-blob-content-disposition","x-ms-blob-content-encoding","x-ms-blob-content-language","x-ms-blob-content-length","x-ms-blob-content-md5","x-ms-blob-content-type","x-ms-blob-public-access","x-ms-blob-sequence-number","x-ms-blob-type","x-ms-copy-destination-snapshot","x-ms-creation-time","x-ms-default-encryption-scope","x-ms-delete-snapshots","x-ms-delete-type-permanent","x-ms-deny-encryption-scope-override","x-ms-encryption-algorithm","x-ms-if-sequence-number-eq","x-ms-if-sequence-number-le","x-ms-if-sequence-number-lt","x-ms-incremental-copy","x-ms-lease-action","x-ms-lease-break-period","x-ms-lease-duration","x-ms-lease-id","x-ms-lease-time","x-ms-page-write","x-ms-proposed-lease-id","x-ms-range-get-content-md5","x-ms-rehydrate-priority","x-ms-sequence-number-action","x-ms-sku-nam
${a.sanitize(this)}`;}}n.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR",n.PARSE_ERROR="PARSE_ERROR";}),y.register("3GQNY",function(e,t){f(e.exports,"Sanitizer",()=>s);var i=y("54SfB"),r=y("9TUdx");let a="REDACTED",n=["x-ms-client-request-id","x-ms-return-client-request-id","x-ms-useragent","x-ms-correlation-request-id","x-ms-request-id","client-request-id","ms-cv","return-client-request-id","traceparent","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Origin","Accept","Accept-Encoding","Cache-Control","Connection","Content-Length","Content-Type","Date","ETag","Expires","If-Match","If-Modified-Since","If-None-Match","If-Unmodified-Since","Last-Modified","Pragma","Request-Id","Retry-After","Server","Transfer-Encoding","User-Agent","WWW-Authenticate"],o=["api-version"];class s{constructor({allowedHeaderNames:e=[],allowedQueryParameters:t=[]}={}){e=Array.isArray(e)?n.concat(e):n,t=Array.isArray(t)?o.concat(t):o,this.allowedHeaderNames=new Set(e.map(e=>e.toLowerCase())),this.allowedQueryParameters=new Set(t.map(e=>e.toLowerCase()));}sanitize(e){let t=new Set();return JSON.stringify(e,(e,i)=>{if(i instanceof Error)return Object.assign(Object.assign({},i),{name:i.name,message:i.message});if("_headersMap"===e)return this.sanitizeHeaders(i);if("url"===e)return this.sanitizeUrl(i);if("query"===e)return this.sanitizeQuery(i);if("body"!==e){if("response"===e)return;if("operationSpec"===e)return;else if(Array.isArray(i)||(0,r.isObject)(i)){if(t.has(i))return"[Circular]";t.add(i);}return i;}},2);}sanitizeHeaders(e){return this.sanitizeObject(e,this.allowedHeaderNames,(e,t)=>e[t].value);}sanitizeQuery(e){return this.sanitizeObject(e,this.allowedQueryParameters,(e,t)=>e[t]);}sanitizeObject(e,t,i){if("object"!=typeof e||null===e)return e;let r={};for(let n of Object.keys(e))t.has(n.toLowerCase())?r[n]=i(e,n):r[n]=a;return r;}sanitizeUrl(e){if("string"!=typeof e||null===e)return e;let t=(0,i.URLBuilder).parse(e),r=t.getQuery();if(!r)return e;let n=(0,i.URLQuery).parse(r);for(let e of n.keys())this.allowedQueryParameters.has(e.toLowerCase())||n.set(e,a);return t.setQuery(n.toString()),t.toString();}}}),y.register("0fs4o",function(e,t){f(e.exports,"custom",()=>i);let i=r.inspect.custom;}),y.register("hTkIg",function(e,t){f(e.exports,"stringifyXML",()=>s),f(e.exports,"parseXML",()=>u);var i=y("fCsC6"),r=y("hcBCZ");let a={explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:r.XML_ATTRKEY,explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:void 0,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:void 0,attrValueProcessors:void 0,tagNameProcessors:void 0,valueProcessors:void 0,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:void 0,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1},n=Object.assign({},a);n.explicitArray=!1;let o=Object.assign({},a);function s(e,t={}){var a;o.rootName=t.rootName,o.charkey=null!==(a=t.xmlCharKey)&&void 0!==a?a:r.XML_CHARKEY;let n=new i.Builder(o);return n.buildObject(e);}function u(e,t={}){var a;n.explicitRoot=!!t.includeRoot,n.charkey=null!==(a=t.xmlCharKey)&&void 0!==a?a:r.XML_CHARKEY;let o=new i.Parser(n);return new Promise((t,i)=>{e?o.parseString(e,(e,r)=>{e?i(e):t(r);}):i(Error("Document is empty"));});}o.explicitArray=!1,o.renderOpts={pretty:!1};}),y.register("fCsC6",function(e,t){(function(){"use strict";var t,i,r,a,n=function(e,t){for(var i in t)o.call(t,i)&&(e[i]=t[i]);function r(){this.constructor=e;}return r.prototype=t.prototype,e.prototype=new r(),e.__super__=t.prototype,e;},o={}.hasOwnProperty;i=y("3hqRG"),t=y("6RJgg"),r=y("eXYIR"),a=y("i2q47"),e.exports.defaults=i.defaults,e.exports.processors=a,e.exports.ValidationError=function(e){function t(e){this.message=e;}return n(t,e),t;}(Error),e.exports.Builder=t.B
//# sourceMappingURL=actions_python.7a37fdc4.js.map