jsii-pacmak 1.95.0 → 1.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/targets/python.js +12 -0
- package/lib/targets/version-utils.js +45 -21
- package/lib/version.d.ts +1 -1
- package/lib/version.js +3 -3
- package/package.json +12 -12
package/lib/targets/python.js
CHANGED
|
@@ -1165,6 +1165,18 @@ class PythonModule {
|
|
|
1165
1165
|
};
|
|
1166
1166
|
// Before we write anything else, we need to write out our module headers, this
|
|
1167
1167
|
// is where we handle stuff like imports, any required initialization, etc.
|
|
1168
|
+
// If multiple packages use the same namespace (in Python, a directory) it
|
|
1169
|
+
// depends on how they are laid out on disk if deep imports of multiple packages
|
|
1170
|
+
// will succeed. `pip` merges all packages into the same directory, and deep
|
|
1171
|
+
// imports work automatically. `bazel` puts packages into different directories,
|
|
1172
|
+
// and `import aws_cdk.subpackage` will fail if `aws_cdk/__init__.py` and
|
|
1173
|
+
// `aws_cdk/subpackage/__init__.py` are not in the same directory.
|
|
1174
|
+
//
|
|
1175
|
+
// We can get around this by using `pkgutil` to extend the search path for the
|
|
1176
|
+
// current module (`__path__`) with all packages found on `sys.path`.
|
|
1177
|
+
code.line('from pkgutil import extend_path');
|
|
1178
|
+
code.line('__path__ = extend_path(__path__, __name__)');
|
|
1179
|
+
code.line();
|
|
1168
1180
|
code.line('import abc');
|
|
1169
1181
|
code.line('import builtins');
|
|
1170
1182
|
code.line('import datetime');
|
|
@@ -81,30 +81,54 @@ function toReleaseVersion(assemblyVersion, target) {
|
|
|
81
81
|
}
|
|
82
82
|
switch (target) {
|
|
83
83
|
case _1.TargetName.PYTHON:
|
|
84
|
+
const baseVersion = `${version.major}.${version.minor}.${version.patch}`;
|
|
84
85
|
// Python supports a limited set of identifiers... And we have a mapping table...
|
|
85
86
|
// https://packaging.python.org/guides/distributing-packages-using-setuptools/#pre-release-versioning
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
87
|
+
const releaseLabels = {
|
|
88
|
+
alpha: 'a',
|
|
89
|
+
beta: 'b',
|
|
90
|
+
rc: 'rc',
|
|
91
|
+
post: 'post',
|
|
92
|
+
dev: 'dev',
|
|
93
|
+
pre: 'pre',
|
|
94
|
+
};
|
|
95
|
+
const validationErrors = [];
|
|
96
|
+
// Ensure that prerelease composed entirely of [label, sequence] pairs
|
|
97
|
+
version.prerelease.forEach((elem, idx, arr) => {
|
|
98
|
+
const next = arr[idx + 1];
|
|
99
|
+
if (typeof elem === 'string') {
|
|
100
|
+
if (!Object.keys(releaseLabels).includes(elem)) {
|
|
101
|
+
validationErrors.push(`Label ${elem} is not one of ${Object.keys(releaseLabels).join(',')}`);
|
|
102
|
+
}
|
|
103
|
+
if (next === undefined || !Number.isInteger(next)) {
|
|
104
|
+
validationErrors.push(`Label ${elem} must be followed by a positive integer`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
if (validationErrors.length > 0) {
|
|
109
|
+
throw new Error(`Unable to map prerelease identifier (in: ${assemblyVersion}) components to python: ${(0, util_1.inspect)(version.prerelease)}. The format should be 'X.Y.Z-[label.sequence][.post.sequence][.(dev|pre).sequence]', where sequence is a positive integer and label is one of ${(0, util_1.inspect)(Object.keys(releaseLabels))}. Validation errors encountered: ${validationErrors.join(', ')}`);
|
|
107
110
|
}
|
|
111
|
+
// PEP440 supports multiple labels in a given version, so
|
|
112
|
+
// we should attempt to identify and map as many labels as
|
|
113
|
+
// possible from the given prerelease input
|
|
114
|
+
// e.g. 1.2.3-rc.123.dev.456.post.789 => 1.2.3.rc123.dev456.post789
|
|
115
|
+
const postIdx = version.prerelease.findIndex((v) => v.toString() === 'post');
|
|
116
|
+
const devIdx = version.prerelease.findIndex((v) => ['dev', 'pre'].includes(v.toString()));
|
|
117
|
+
const preReleaseIdx = version.prerelease.findIndex((v) => ['alpha', 'beta', 'rc'].includes(v.toString()));
|
|
118
|
+
const prereleaseVersion = [
|
|
119
|
+
preReleaseIdx > -1
|
|
120
|
+
? `${releaseLabels[version.prerelease[preReleaseIdx]]}${version.prerelease[preReleaseIdx + 1] ?? 0}`
|
|
121
|
+
: undefined,
|
|
122
|
+
postIdx > -1
|
|
123
|
+
? `post${version.prerelease[postIdx + 1] ?? 0}`
|
|
124
|
+
: undefined,
|
|
125
|
+
devIdx > -1 ? `dev${version.prerelease[devIdx + 1] ?? 0}` : undefined,
|
|
126
|
+
]
|
|
127
|
+
.filter((v) => v)
|
|
128
|
+
.join('.');
|
|
129
|
+
return version.build.length > 0
|
|
130
|
+
? `${baseVersion}.${prereleaseVersion}+${version.build.join('.')}`
|
|
131
|
+
: `${baseVersion}.${prereleaseVersion}`;
|
|
108
132
|
case _1.TargetName.DOTNET:
|
|
109
133
|
case _1.TargetName.GO:
|
|
110
134
|
case _1.TargetName.JAVA:
|
package/lib/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
|
|
2
2
|
export declare const VERSION: string;
|
|
3
3
|
/** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
|
|
4
|
-
export declare const VERSION_DESC = "1.
|
|
4
|
+
export declare const VERSION_DESC = "1.97.0 (build 729de35)";
|
|
5
5
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/version.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated at 2024-
|
|
2
|
+
// Generated at 2024-04-08T20:13:17Z by generate.sh
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.VERSION_DESC = exports.VERSION = void 0;
|
|
5
5
|
/** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
7
|
-
exports.VERSION = '1.
|
|
7
|
+
exports.VERSION = '1.97.0';
|
|
8
8
|
/** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
|
|
9
|
-
exports.VERSION_DESC = '1.
|
|
9
|
+
exports.VERSION_DESC = '1.97.0 (build 729de35)';
|
|
10
10
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsii-pacmak",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.97.0",
|
|
4
4
|
"description": "A code generation framework for jsii backend languages",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,33 +37,33 @@
|
|
|
37
37
|
"package": "package-js"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@jsii/check-node": "1.
|
|
41
|
-
"@jsii/spec": "^1.
|
|
40
|
+
"@jsii/check-node": "1.97.0",
|
|
41
|
+
"@jsii/spec": "^1.97.0",
|
|
42
42
|
"clone": "^2.1.2",
|
|
43
|
-
"codemaker": "^1.
|
|
43
|
+
"codemaker": "^1.97.0",
|
|
44
44
|
"commonmark": "^0.30.0",
|
|
45
45
|
"escape-string-regexp": "^4.0.0",
|
|
46
46
|
"fs-extra": "^10.1.0",
|
|
47
|
-
"jsii-reflect": "^1.
|
|
48
|
-
"jsii-rosetta": "^1.
|
|
47
|
+
"jsii-reflect": "^1.97.0",
|
|
48
|
+
"jsii-rosetta": "^1.97.0",
|
|
49
49
|
"semver": "^7.5.4",
|
|
50
50
|
"spdx-license-list": "^6.8.0",
|
|
51
51
|
"xmlbuilder": "^15.1.1",
|
|
52
52
|
"yargs": "^16.2.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@jsii/dotnet-runtime": "^1.
|
|
56
|
-
"@jsii/java-runtime": "^1.
|
|
57
|
-
"@jsii/go-runtime": "^1.
|
|
58
|
-
"@scope/jsii-calc-lib": "^1.
|
|
55
|
+
"@jsii/dotnet-runtime": "^1.97.0",
|
|
56
|
+
"@jsii/java-runtime": "^1.97.0",
|
|
57
|
+
"@jsii/go-runtime": "^1.97.0",
|
|
58
|
+
"@scope/jsii-calc-lib": "^1.97.0",
|
|
59
59
|
"@types/clone": "^2.1.4",
|
|
60
60
|
"@types/diff": "^5.0.8",
|
|
61
61
|
"@types/commonmark": "^0.27.9",
|
|
62
62
|
"@types/fs-extra": "^9.0.13",
|
|
63
63
|
"@types/semver": "^7.5.5",
|
|
64
64
|
"diff": "^5.1.0",
|
|
65
|
-
"jsii": "^1.
|
|
66
|
-
"jsii-build-tools": "^1.
|
|
65
|
+
"jsii": "^1.97.0",
|
|
66
|
+
"jsii-build-tools": "^1.97.0",
|
|
67
67
|
"jsii-calc": "^3.20.120",
|
|
68
68
|
"pyright": "^1.1.332"
|
|
69
69
|
},
|