@u4/opencv-build
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -37,2 +37,3 @@ "use strict"; | ||
} | ||
const DEFAULT_OPENCV_VERSION = '4.6.0'; | ||
class OpenCVBuildEnv { | ||
@@ -232,2 +233,21 @@ get cudaArch() { | ||
} | ||
getExpectedVersion() { | ||
if (this.no_autobuild) { | ||
return '0.0.0'; | ||
} | ||
const opencvVersion = this.resolveValue(misc_js_1.ALLARGS.version); | ||
if (opencvVersion) | ||
return opencvVersion; | ||
return DEFAULT_OPENCV_VERSION; | ||
} | ||
// private getExpectedBuildWithCuda(): boolean { | ||
// return !!this.resolveValue(ALLARGS.cuda); | ||
// } | ||
// this.autoBuildFlags = this.resolveValue(ALLARGS.flags); | ||
// this.#cudaArch = this.resolveValue(ALLARGS.cudaArch); | ||
// this.isWithoutContrib = !!this.resolveValue(ALLARGS.nocontrib); | ||
// this.isAutoBuildDisabled = !!this.resolveValue(ALLARGS.nobuild); | ||
// this.keepsources = !!this.resolveValue(ALLARGS.keepsources); | ||
// this.dryRun = !!this.resolveValue(ALLARGS['dry-run']); | ||
// this.gitCache = !!this.resolveValue(ALLARGS['git-cache']); | ||
resolveValue(info) { | ||
@@ -282,3 +302,2 @@ let value = ''; | ||
this.hash = ''; | ||
const DEFAULT_OPENCV_VERSION = '4.6.0'; | ||
this.prebuild = opts.prebuild; | ||
@@ -304,6 +323,11 @@ this._platform = process.platform; | ||
if (!this.no_autobuild && opts.prebuild) { | ||
const builds = OpenCVBuildEnv.listBuild(this.rootDir); | ||
let builds = OpenCVBuildEnv.listBuild(this.rootDir); | ||
if (!builds.length) { | ||
throw Error(`No build found in ${this.rootDir} you should launch opencv-build-npm once`); | ||
} | ||
const expVer = this.getExpectedVersion(); | ||
builds = builds.filter(b => b.buildInfo.opencvVersion === expVer); | ||
if (!builds.length) { | ||
throw Error(`No build of version ${expVer} found in ${this.rootDir} you should launch opencv-build-npm`); | ||
} | ||
if (builds.length > 1) { | ||
@@ -371,10 +395,4 @@ switch (opts.prebuild) { | ||
else { | ||
this.opencvVersion = this.resolveValue(misc_js_1.ALLARGS.version); | ||
if (!this.opencvVersion) { | ||
this.opencvVersion = DEFAULT_OPENCV_VERSION; | ||
npmlog_1.default.info('init', `no openCV version given using default verison ${(0, utils_js_1.formatNumber)(DEFAULT_OPENCV_VERSION)}`); | ||
} | ||
else { | ||
npmlog_1.default.info('init', `using openCV verison ${(0, utils_js_1.formatNumber)(this.opencvVersion)}`); | ||
} | ||
this.opencvVersion = this.getExpectedVersion(); | ||
npmlog_1.default.info('init', `using openCV verison ${(0, utils_js_1.formatNumber)(this.opencvVersion)}`); | ||
if (process.env.INIT_CWD) { | ||
@@ -381,0 +399,0 @@ npmlog_1.default.info('init', `${(0, utils_js_1.highlight)("INIT_CWD")} is defined overwriting root path to ${(0, utils_js_1.highlight)(process.env.INIT_CWD)}`); |
@@ -72,2 +72,3 @@ /// <reference types="node" /> | ||
}; | ||
private getExpectedVersion; | ||
private resolveValue; | ||
@@ -74,0 +75,0 @@ constructor(opts?: OpenCVBuildEnvParams); |
@@ -32,2 +32,3 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
} | ||
const DEFAULT_OPENCV_VERSION = '4.6.0'; | ||
export default class OpenCVBuildEnv { | ||
@@ -227,2 +228,21 @@ get cudaArch() { | ||
} | ||
getExpectedVersion() { | ||
if (this.no_autobuild) { | ||
return '0.0.0'; | ||
} | ||
const opencvVersion = this.resolveValue(ALLARGS.version); | ||
if (opencvVersion) | ||
return opencvVersion; | ||
return DEFAULT_OPENCV_VERSION; | ||
} | ||
// private getExpectedBuildWithCuda(): boolean { | ||
// return !!this.resolveValue(ALLARGS.cuda); | ||
// } | ||
// this.autoBuildFlags = this.resolveValue(ALLARGS.flags); | ||
// this.#cudaArch = this.resolveValue(ALLARGS.cudaArch); | ||
// this.isWithoutContrib = !!this.resolveValue(ALLARGS.nocontrib); | ||
// this.isAutoBuildDisabled = !!this.resolveValue(ALLARGS.nobuild); | ||
// this.keepsources = !!this.resolveValue(ALLARGS.keepsources); | ||
// this.dryRun = !!this.resolveValue(ALLARGS['dry-run']); | ||
// this.gitCache = !!this.resolveValue(ALLARGS['git-cache']); | ||
resolveValue(info) { | ||
@@ -277,3 +297,2 @@ let value = ''; | ||
this.hash = ''; | ||
const DEFAULT_OPENCV_VERSION = '4.6.0'; | ||
this.prebuild = opts.prebuild; | ||
@@ -299,6 +318,11 @@ this._platform = process.platform; | ||
if (!this.no_autobuild && opts.prebuild) { | ||
const builds = OpenCVBuildEnv.listBuild(this.rootDir); | ||
let builds = OpenCVBuildEnv.listBuild(this.rootDir); | ||
if (!builds.length) { | ||
throw Error(`No build found in ${this.rootDir} you should launch opencv-build-npm once`); | ||
} | ||
const expVer = this.getExpectedVersion(); | ||
builds = builds.filter(b => b.buildInfo.opencvVersion === expVer); | ||
if (!builds.length) { | ||
throw Error(`No build of version ${expVer} found in ${this.rootDir} you should launch opencv-build-npm`); | ||
} | ||
if (builds.length > 1) { | ||
@@ -366,10 +390,4 @@ switch (opts.prebuild) { | ||
else { | ||
this.opencvVersion = this.resolveValue(ALLARGS.version); | ||
if (!this.opencvVersion) { | ||
this.opencvVersion = DEFAULT_OPENCV_VERSION; | ||
log.info('init', `no openCV version given using default verison ${formatNumber(DEFAULT_OPENCV_VERSION)}`); | ||
} | ||
else { | ||
log.info('init', `using openCV verison ${formatNumber(this.opencvVersion)}`); | ||
} | ||
this.opencvVersion = this.getExpectedVersion(); | ||
log.info('init', `using openCV verison ${formatNumber(this.opencvVersion)}`); | ||
if (process.env.INIT_CWD) { | ||
@@ -376,0 +394,0 @@ log.info('init', `${highlight("INIT_CWD")} is defined overwriting root path to ${highlight(process.env.INIT_CWD)}`); |
{ | ||
"name": "@u4/opencv-build", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "A simple script to auto build recent OpenCV + contrib version via npm 2022 Edition", | ||
"type": "module", | ||
"type": "commonjs", | ||
"main": "dist/cjs/index.js", | ||
@@ -7,0 +7,0 @@ "module": "./dist/esm/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
273915
3462
2
No