mirror of https://github.com/aminya/setup-cpp
6 lines
1.3 MiB
JavaScript
6 lines
1.3 MiB
JavaScript
|
var e=require("path"),t=require("os"),r=require("fs"),i=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,r,i){Object.defineProperty(e,t,{get:r,set:i,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("4kQHk",function(t,r){f(t.exports,"setupActionsPython",()=>x);var i=y("7tXqc"),a=y("gMRkJ"),n=y("ER74K"),o=y("lcRzN"),s=y("ceI0e"),u=y("dTX7a"),c=y("5a5g2"),l=y("g8WuM"),p=y("dOmbL"),d=e.resolve(__dirname,"../../src/python");async function m(e,t){let r=(0,l.getCacheDistributor)(e,t,void 0);await r.restoreCache();}async function x(e,t,r){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 i=await(0,a.findPyPyVersion)(e,r,!0,!1,!1);t=`${i.resolvedPyPyVersion}-${i.resolvedPythonVersion}`,(0,n.info)(`Successfully set up PyPy ${i.resolvedPyPyVersion} with Python (${i.resolvedPythonVersion})`);}else{let a=await(0,i.useCpythonVersion)(e,r,!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("7tXqc",function(r,i){f(r.exports,"useCpythonVersion",()=>c);var a=y("5a5g2"),n=y("496bk"),o=y("5K6T3"),s=y("lcRzN"),u=y("4ai2V");async function c(r,i,c,l,p){var d;let m;let x=null,h=r.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 ${r} is ${f}`),l){x=await o.getManifest();let e=(await o.findReleaseFromManifest(f,i,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,i);if(!g){s.info(`Version ${f} was not found in the local cache`);let e=await o.findReleaseFromManifest(f,i,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,i));}if(!g){let e=await(0,a.getOSInfo)();throw Error([`The version '${r}' with architecture '${i}' 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}`:"",r=e.join(g,"lib");t.split(":").includes(r)||s.exportVariable("LD_LIBRARY_PATH",r+t);}if(s.addPath(g),s.addPath(D),a.IS_WINDOWS){let t=e.basename(e.dirname(g)),r=n.major(t),i=n.minor(t),a=e.join(process.env.APPDATA||"","Python",`Python${r}${i}`,"Scripts");s.addPath(a);}}let v=function(t){let r=t.split(e.sep),i=r.findIndex(e=>"PyPy"===e||"Python"===e);return r[i+1]||"";}(g);return s.setOutput("python-version",v),s.setOutput("python-path",b),{impl:"CPython",version:v};}}),y.register("5a5g2",
|
||
|
Other caches with similar key:`),(null==t?void 0:t.artifactCaches)||[]))c.debug(`Cache Key: ${null==i?void 0:i.cacheKey}, Cache Version: ${null==i?void 0:i.cacheVersion}, Cache Scope: ${null==i?void 0:i.scope}, Cache Created: ${null==i?void 0:i.creationTime}`);}});}(e[0],i,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,r){return u(this,void 0,void 0,function*(){let i=new o.URL(e),a=(0,f.getDownloadOptions)(r);a.useAzureSdk&&i.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,r){return u(this,void 0,void 0,function*(){let i=b(),a=v(t,null==r?void 0:r.compressionMethod,null==r?void 0:r.enableCrossOsArchive),n={key:e,version:a,cacheSize:null==r?void 0:r.cacheSize},o=yield(0,g.retryTypedResponse)("reserveCache",()=>u(this,void 0,void 0,function*(){return i.postJson(D("caches"),n);}));return o;});},e.exports.saveCache=function(e,t,r){return u(this,void 0,void 0,function*(){let i=b();c.debug("Upload cache"),yield function(e,t,r,i){return u(this,void 0,void 0,function*(){let a=x.getArchiveFileSizeInBytes(r),n=D(`caches/${t.toString()}`),o=m.openSync(r,"r"),s=(0,f.getUploadOptions)(i),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),i=h,s=h+t-1;h+=p,yield function(e,t,r,i,a){return u(this,void 0,void 0,function*(){c.debug(`Uploading chunk of size ${a-i+1} bytes at offset ${i} with content range: ${C(i,a)}`);let n={"Content-Type":"application/octet-stream","Content-Range":C(i,a)},o=yield(0,g.retryHttpClientResponse)(`uploadChunk (start: ${i}, end: ${a})`,()=>u(this,void 0,void 0,function*(){return e.sendStream("PATCH",t,r(),n);}));if(!(0,g.isSuccessStatusCode)(o.message.statusCode))throw Error(`Cache service responded with ${o.message.statusCode} during upload chunk.`);});}(e,n,()=>m.createReadStream(r,{fd:o,start:i,end:s,autoClose:!1}).on("error",e=>{throw Error(`Cache upload failed because file read failed with ${e.message}`);}),i,s);}})));}finally{m.closeSync(o);}});}(i,e,t,r),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,r){return u(this,void 0,void 0,function*(){let i={size:r};return yield(0,g.retryTypedResponse)("commitCache",()=>u(this,void 0,void 0,function*(){return e.postJson(D(`caches/${t.toString()}`),i);}));});}(i,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("dJfwp",function(e,t){"use strict";var a=e.exports&&e.exports.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var a=Object.getOwnPropertyDescriptor(t,r);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[r];}}),Object.defineProperty(e,i,a);}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r];}),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 r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&a(t,e,r);return n(t,e),t;},c=e.exports&&e.exports.__awaiter||function(e,t,r,i){return new(r||(r=Promise))(function(a,n){function o(e){try{u(i.next(e));}catch(e){n(e);}}function s(e){try{u(i.throw(e));}catch(e){n(e);}}function u(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t);})).then(o,s);}u((i=i.apply(e,t||[])).
|
||
|
`;}),i;}getCanonicalizedResourceString(e){let t=(0,i.getURLPath)(e.url)||"/",r="";r+=`/${this.factory.accountName}${t}`;let a=(0,i.getURLQueries)(e.url),n={};if(a){let e=[];for(let t in a)if(Object.prototype.hasOwnProperty.call(a,t)){let r=t.toLowerCase();n[r]=a[t],e.push(r);}for(let t of(e.sort(),e))r+=`
|
||
|
${t}:${decodeURIComponent(n[t])}`;}return r;}}}),y.register("5MFjo",function(e,t){f(e.exports,"SDK_VERSION",()=>r),f(e.exports,"SERVICE_VERSION",()=>i),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 r="12.15.0",i="2023-01-03",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("fH185",function(e,t){f(e.exports,"Sanitizer",()=>s);var r=y("65kMX"),i=y("8i3wZ");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,r)=>{if(r instanceof Error)return Object.assign(Object.assign({},r),{name:r.name,message:r.message});if("_headersMap"===e)return this.sanitizeHeaders(r);if("url"===e)return this.sanitizeUrl(r);if("query"===e)return this.sanitizeQuery(r);if("body"!==e){if("response"===e)return;if("operationSpec"===e)return;else if(Array.isArray(r)||(0,i.isObject)(r)){if(t.has(r))return"[Circular]";t.add(r);}return r;}},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,r){if("object"!=typeof e||null===e)return e;let i={};for(let n of Object.keys(e))t.has(n.toLowerCase())?i[n]=r(e,n):i[n]=a;return i;}sanitizeUrl(e){if("string"!=typeof e||null===e)return e;let t=(0,r.URLBuilder).parse(e),i=t.getQuery();if(!i)return e;let n=(0,r.URLQuery).parse(i);for(let e of n.keys())this.allowedQueryParameters.has(e.toLowerCase())||n.set(e,a);return t.setQuery(n.toString()),t.toString();}}}),y.register("bn8hv",function(e,t){f(e.exports,"custom",()=>r);let r=i.inspect.custom;}),y.register("Ahf9T",function(e,t){f(e.exports,"stringifyXML",()=>s),f(e.exports,"parseXML",()=>u);var r=y("9OKsB"),i=y("WRKX0");let a={explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:i.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:i.XML_CHARKEY;let n=new r.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:i.XML_CHARKEY;let o=new r.Parser(n);return new Promise((t,r)=>{e?o.parseString(e,(e,i)=>{e?r(e):t(i);}):r(Error("Document is empty"));});}o.explicitArray=!1,o.renderOpts={pretty:!1};}),y.register("9OKsB",function(e,t){(function(){"use strict";var t,r,i,a,n=function(e,t){for(var r in t)o.call(t,r)&&(e[r]=t[r]);function i(){this.constructor=e;}return i.prototype=t.prototype,e.prototype=new i(),e.__super__=t.prototype,e;},o={}.hasOwnProperty;r=y("AfX4q"),t=y("hBFg5"),i=y("7JuJD"),a=y("jyooR"),e.exports.defaults=r.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.62d0ce0e.js.map
|