Skip to content

Commit

Permalink
Merge pull request #1793 from aws/bump/1.9.0
Browse files Browse the repository at this point in the history
chore(release): 1.9.0
  • Loading branch information
MrArnoldPalmer authored Jul 17, 2020
2 parents 4a047ac + 004d3b7 commit 31ecd2d
Show file tree
Hide file tree
Showing 22 changed files with 1,118 additions and 812 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.9.0](https://github.com/aws/jsii/compare/v1.8.0...v1.9.0) (2020-07-16)


### Bug Fixes

* **jsii-reflect:** TypeSystem.methods and .properties ignores submodules ([#1779](https://github.com/aws/jsii/issues/1779)) ([bdb5483](https://github.com/aws/jsii/commit/bdb5483e95e0e0ec6b556f5a06b92018bfe1a642))
* **pacmak:** python pack fails when installing 'black' via pip ([#1782](https://github.com/aws/jsii/issues/1782)) ([d83e004](https://github.com/aws/jsii/commit/d83e0043f3a8a40dcf79b60ffce4837721617149))
* **pacmak:** race condition in python packing when run over multiple packages ([#1783](https://github.com/aws/jsii/issues/1783)) ([7807027](https://github.com/aws/jsii/commit/7807027d6751fcdaaa06544a3755215937e8d9e9))

## [1.8.0](https://github.com/aws/jsii/compare/v1.7.0...v1.8.0) (2020-07-02)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"rejectCycles": true
}
},
"version": "1.8.0"
"version": "1.9.0"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.22.0",
"lerna": "^3.22.1",
"standard-version": "^8.0.0"
"standard-version": "^8.0.2"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions packages/@jsii/integ-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
},
"devDependencies": {
"@types/dotenv": "^8.2.0",
"@types/fs-extra": "^8.1.0",
"@types/jest": "^26.0.3",
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.4",
"@types/node": "^10.17.26",
"@types/tar": "^4.0.3",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^1.19.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/@jsii/kernel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"devDependencies": {
"@scope/jsii-calc-base": "^0.0.0",
"@scope/jsii-calc-lib": "^0.0.0",
"@types/fs-extra": "^8.1.0",
"@types/jest": "^26.0.3",
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.4",
"@types/jest-expect-message": "^1.0.2",
"@types/node": "^10.17.26",
"@types/tar": "^4.0.3",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"devDependencies": {
"@scope/jsii-calc-base": "^0.0.0",
"@scope/jsii-calc-lib": "^0.0.0",
"@types/jest": "^26.0.3",
"@types/jest": "^26.0.4",
"@types/node": "^10.17.26",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"jsonschema": "^1.2.6"
},
"devDependencies": {
"@types/jest": "^26.0.3",
"@types/jest": "^26.0.4",
"@types/node": "^10.17.26",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/codemaker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"fs-extra": "^9.0.1"
},
"devDependencies": {
"@types/fs-extra": "^8.1.0",
"@types/jest": "^26.0.3",
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.4",
"@types/node": "^10.17.26",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/jsii-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
},
"devDependencies": {
"@types/inquirer": "^6.5.0",
"@types/jest": "^26.0.3",
"@types/jest": "^26.0.4",
"@types/jest-expect-message": "^1.0.2",
"@types/node": "^10.17.26",
"@types/yargs": "^15.0.5",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
Expand All @@ -35,7 +35,7 @@
"dependencies": {
"@jsii/spec": "^0.0.0",
"inquirer": "^7.3.0",
"yargs": "^15.3.1"
"yargs": "^15.4.0"
},
"jest": {
"collectCoverage": true,
Expand Down
8 changes: 4 additions & 4 deletions packages/jsii-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@
"jsii-reflect": "^0.0.0",
"log4js": "^6.3.0",
"typescript": "~3.9.6",
"yargs": "^15.3.1"
"yargs": "^15.4.0"
},
"devDependencies": {
"@types/fs-extra": "^8.1.0",
"@types/jest": "^26.0.3",
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.4",
"@types/jest-expect-message": "^1.0.2",
"@types/node": "^10.17.26",
"@types/tar-fs": "^2.0.0",
"@types/yargs": "^15.0.5",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
Expand Down
100 changes: 61 additions & 39 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as path from 'path';
import * as spec from '@jsii/spec';
import { Stability } from '@jsii/spec';
import { Generator, GeneratorOptions } from '../generator';
import { warn } from '../logging';
import { info, warn } from '../logging';
import { md2rst } from '../markdown';
import { Target, TargetOptions } from '../target';
import { shell } from '../util';
Expand All @@ -34,6 +34,8 @@ import { die, toPythonIdentifier } from './python/util';
const spdxLicenseList = require('spdx-license-list');

export default class Python extends Target {
private static BLACK_PATH?: Promise<string>;

protected readonly generator: PythonGenerator;

public constructor(options: TargetOptions) {
Expand All @@ -45,29 +47,15 @@ export default class Python extends Target {
public async generateCode(outDir: string, tarball: string): Promise<void> {
await super.generateCode(outDir, tarball);

// We'll just run "black" on that now, to make the generated code a little more readable.
const blackRoot = await fs.mkdtemp(
path.join(os.tmpdir(), 'jsii-pacmak-black-'),
);
try {
await shell('python3', ['-m', 'venv', path.join(blackRoot, '.env')], {
cwd: blackRoot,
});
await shell(
path.join(blackRoot, '.env', 'bin', 'pip'),
['install', 'black'],
{ cwd: blackRoot },
);
await shell(
path.join(blackRoot, '.env', 'bin', 'black'),
['--py36', outDir],
{
cwd: outDir,
},
);
} finally {
await fs.remove(blackRoot);
// Using a static variable as a lock to prevent racing. Since blackPath() uses
// Promise APIs from fs and os modules (that use libuv), an additional lock is required.
if (Python.BLACK_PATH === undefined) {
Python.BLACK_PATH = this.blackPath();
}
// We'll just run "black" on that now, to make the generated code a little more readable.
await shell(await Python.BLACK_PATH, ['--py36', outDir], {
cwd: outDir,
});
}

public async build(sourceDir: string, outDir: string): Promise<void> {
Expand All @@ -78,7 +66,7 @@ export default class Python extends Target {
await shell('python3', ['setup.py', 'bdist_wheel', '--dist-dir', outDir], {
cwd: sourceDir,
});
if (await twineIsPresent()) {
if (await isPresent('twine', sourceDir)) {
await shell('twine', ['check', path.join(outDir, '*')], {
cwd: sourceDir,
});
Expand All @@ -88,22 +76,56 @@ export default class Python extends Target {
'Run `pip3 install twine` to enable distribution package validation.',
);
}
}

// Approximating existence check using `which`, falling back on `pip3 show`. If that fails, assume twine is not there.
async function twineIsPresent(): Promise<boolean> {
try {
await shell('which', ['twine'], { cwd: sourceDir });
return true;
} catch {
try {
const output = await shell('pip3', ['show', 'twine'], {
cwd: sourceDir,
});
return output.trim() !== '';
} catch {
return false;
}
}
private async blackPath(): Promise<string> {
if (await isPresent('black')) {
return 'black';
}

const blackInstallDir = path.join(
os.homedir(),
'.jsii-cache',
'python-black',
);
const exists = await fs.pathExists(blackInstallDir);
if (!exists) {
info(
`No existing black installation. Install afresh at ${blackInstallDir}...`,
);
await fs.mkdirp(blackInstallDir);
await shell(
'python3',
['-m', 'venv', path.join(blackInstallDir, '.env')],
{
cwd: blackInstallDir,
},
);
await shell(
path.join(blackInstallDir, '.env', 'bin', 'pip'),
['install', 'black'],
{ cwd: blackInstallDir },
);
}
return path.join(blackInstallDir, '.env', 'bin', 'black');
}
}

// Approximating existence check using `which`, falling back on `pip3 show`.
async function isPresent(binary: string, sourceDir?: string): Promise<boolean> {
try {
await shell('which', [binary], {
cwd: sourceDir,
});
return true;
} catch {
try {
const output = await shell('pip3', ['show', binary], {
cwd: sourceDir,
});
return output.trim() !== '';
} catch {
return false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function resolveDependencyDirectory(
export async function shell(
cmd: string,
args: string[],
options: ShellOptions,
options: ShellOptions = {},
): Promise<string> {
// eslint-disable-next-line @typescript-eslint/require-await
async function spawn1() {
Expand Down
10 changes: 5 additions & 5 deletions packages/jsii-pacmak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"watch": "tsc --build -w",
"lint": "eslint . --ext .js,.ts --ignore-path=.gitignore",
"lint:fix": "yarn lint --fix",
"test": "/bin/bash test/diff-test.sh && /bin/bash test/build-test.sh && jest",
"test": "jest && /bin/bash test/diff-test.sh && /bin/bash test/build-test.sh",
"test:update": "UPDATE_DIFF=1 /bin/bash test/diff-test.sh && /bin/bash test/build-test.sh && jest -u",
"package": "package-js"
},
Expand All @@ -46,21 +46,21 @@
"semver": "^7.3.2",
"spdx-license-list": "^6.2.0",
"xmlbuilder": "^15.1.1",
"yargs": "^15.3.1"
"yargs": "^15.4.0"
},
"devDependencies": {
"@jsii/dotnet-runtime": "^0.0.0",
"@jsii/java-runtime": "^0.0.0",
"@scope/jsii-calc-lib": "^0.0.0",
"@types/clone": "^0.1.30",
"@types/commonmark": "^0.27.4",
"@types/fs-extra": "^8.1.0",
"@types/jest": "^26.0.3",
"@types/fs-extra": "^8.1.1",
"@types/jest": "^26.0.4",
"@types/mock-fs": "^4.10.0",
"@types/node": "^10.17.26",
"@types/semver": "^7.3.1",
"@types/yargs": "^15.0.5",
"eslint": "^7.3.1",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.1.0",
Expand Down
Loading

0 comments on commit 31ecd2d

Please sign in to comment.