Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Generator, GeneratorOptions } from '../generator';
import { warn } from '../logging';
import { md2rst } from '../markdown';
import { Target } from '../target';
import { shell } from '../util';
import { shell, nextMajorVersion } from '../util';

/* eslint-disable @typescript-eslint/no-var-requires */
const spdxLicenseList = require('spdx-license-list');
Expand Down Expand Up @@ -1140,26 +1140,16 @@ class Package {
const expectedDeps = this.metadata.dependencies || {};
for (const depName of Object.keys(expectedDeps)) {
const depInfo = expectedDeps[depName];
// We need to figure out what our version range is.
// Basically, if it starts with Zero we want to restrict things to
// ~=X.Y.Z. If it does not start with zero, then we want to do ~=X.Y,>=X.Y.Z.
const versionParts = depInfo.version.split('.');
let versionSpecifier: string;
if (versionParts[0] === '0') {
versionSpecifier = `~=${versionParts.slice(0, 3).join('.')}`;
} else {
versionSpecifier = `~=${versionParts.slice(0, 2).join('.')},>=${versionParts.slice(0, 3).join('.')}`;
}

dependencies.push(`${depInfo.targets!.python!.distName}${versionSpecifier}`);
dependencies.push(`${depInfo.targets!.python!.distName}==${depInfo.version}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have the same meaning like in all other languages?

}

code.openFile('README.md');
code.line(this.convertedReadme);
code.closeFile('README.md');

// Strip " (build abcdef)" from the jsii version
const jsiiVersionSimple = this.metadata.jsiiVersion.replace(/ .*$/, '');
const jsiiVersion = this.metadata.jsiiVersion.replace(/ .*$/, '');
const jsiiNextMajor = nextMajorVersion(jsiiVersion);

/* eslint-disable @typescript-eslint/camelcase */
const setupKwargs = {
Expand All @@ -1179,7 +1169,7 @@ class Package {
packages: modules.map(m => m.pythonName),
package_data: packageData,
python_requires: '>=3.6',
install_requires: [`jsii~=${jsiiVersionSimple}`, 'publication>=0.0.3'].concat(dependencies),
install_requires: [`jsii~=${jsiiVersion},<${jsiiNextMajor}`, 'publication>=0.0.3'].concat(dependencies),
classifiers: [
'Intended Audience :: Developers',
'Operating System :: OS Independent',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"python_requires": ">=3.6",
"install_requires": [
"jsii~=0.20.2",
"jsii~=0.20.2,<0.21.0",
"publication>=0.0.3"
],
"classifiers": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
},
"python_requires": ">=3.6",
"install_requires": [
"jsii~=0.20.2",
"jsii~=0.20.2,<0.21.0",
"publication>=0.0.3",
"scope.jsii-calc-base-of-base~=0.20.2"
"scope.jsii-calc-base-of-base==0.20.2"
],
"classifiers": [
"Intended Audience :: Developers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
},
"python_requires": ">=3.6",
"install_requires": [
"jsii~=0.20.2",
"jsii~=0.20.2,<0.21.0",
"publication>=0.0.3",
"scope.jsii-calc-base~=0.20.2"
"scope.jsii-calc-base==0.20.2"
],
"classifiers": [
"Intended Audience :: Developers",
Expand Down
8 changes: 4 additions & 4 deletions packages/jsii-pacmak/test/expected.jsii-calc/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
},
"python_requires": ">=3.6",
"install_requires": [
"jsii~=0.20.2",
"jsii~=0.20.2,<0.21.0",
"publication>=0.0.3",
"scope.jsii-calc-base~=0.20.2",
"scope.jsii-calc-base-of-base~=0.20.2",
"scope.jsii-calc-lib~=0.20.2"
"scope.jsii-calc-base==0.20.2",
"scope.jsii-calc-base-of-base==0.20.2",
"scope.jsii-calc-lib==0.20.2"
],
"classifiers": [
"Intended Audience :: Developers",
Expand Down