Skip to content

Commit

Permalink
use pip wheel to better isolate python builds
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMuller committed Aug 11, 2020
1 parent 4455afc commit df22ba7
Show file tree
Hide file tree
Showing 6 changed files with 19,097 additions and 20,420 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ jobs:
# Run the integration test
- name: Install Dependencies
run: |-
# Python tools used during packaging
python3 -m pip install --upgrade pipx setuptools twine wheel
# TypeScript project dependencies
yarn install --frozen-lockfile
working-directory: aws-cdk
- name: Install Tested Packages
Expand Down
23 changes: 18 additions & 5 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ export default class Python extends Target {
await shell('python3', ['setup.py', 'sdist', '--dist-dir', outDir], {
cwd: sourceDir,
});
await shell('python3', ['setup.py', 'bdist_wheel', '--dist-dir', outDir], {
cwd: sourceDir,
});
await shell(
'python3',
['-m', 'pip', 'wheel', '--no-deps', '--wheel-dir', outDir, sourceDir],
{
cwd: sourceDir,
},
);
if (await isPresent('twine', sourceDir)) {
await shell('twine', ['check', path.join(outDir, '*')], {
cwd: sourceDir,
});
} else if (await isPresent('pipx', sourceDir)) {
await shell('pipx', ['run', 'twine', 'check', path.join(outDir, '*')], {
cwd: sourceDir,
});
} else {
warn(
'Unable to validate distribution packages because `twine` is not present. ' +
Expand Down Expand Up @@ -1649,6 +1657,9 @@ class Package {
(this.metadata.author.email !== undefined
? `<${this.metadata.author.email}>`
: ''),
bdist_wheel: {
universal: true,
},
project_urls: {
Source: this.metadata.repository.url,
},
Expand All @@ -1659,7 +1670,9 @@ class Package {
install_requires: [
`jsii${toPythonVersionRange(`^${jsiiVersionSimple}`)}`,
'publication>=0.0.3',
].concat(dependencies),
]
.concat(dependencies)
.sort(),
classifiers: [
'Intended Audience :: Developers',
'Operating System :: OS Independent',
Expand Down Expand Up @@ -1719,7 +1732,7 @@ class Package {
// TODO: Might be easier to just use a TOML library to write this out.
code.openFile('pyproject.toml');
code.line('[build-system]');
code.line('requires = ["setuptools >= 38.6.0", "wheel >= 0.31.0"]');
code.line('requires = ["setuptools >= 49.3.1", "wheel >= 0.34.2"]');
code.line('build-backend = "setuptools.build_meta"');
code.closeFile('pyproject.toml');

Expand Down
5 changes: 3 additions & 2 deletions packages/jsii-pacmak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
"watch": "tsc --build -w",
"lint": "eslint . --ext .js,.ts --ignore-path=.gitignore",
"lint:fix": "yarn lint --fix",
"test": "jest && bash test/build-test.sh",
"test:update": "jest -u && bash test/build-test.sh",
"test": "jest && npm run test:build",
"test:build": "bash test/build-test.sh",
"test:update": "jest -u && npm run test:build",
"package": "package-js"
},
"dependencies": {
Expand Down
Loading

0 comments on commit df22ba7

Please sign in to comment.