diff --git a/packages/jsii-pacmak/lib/targets/python.ts b/packages/jsii-pacmak/lib/targets/python.ts index 54bfeab317..22f85650c6 100644 --- a/packages/jsii-pacmak/lib/targets/python.ts +++ b/packages/jsii-pacmak/lib/targets/python.ts @@ -12,6 +12,10 @@ import { md2rst } from '../markdown'; import { Target } from '../target'; import { shell } from '../util'; +/* eslint-disable @typescript-eslint/no-var-requires */ +const spdxLicenseList = require('spdx-license-list'); +/* eslint-enable @typescript-eslint/no-var-requires */ + export default class Python extends Target { protected readonly generator = new PythonGenerator(); @@ -1162,6 +1166,7 @@ class Package { name: this.name, version: this.version, description: this.metadata.description, + license: this.metadata.license, url: this.metadata.homepage, long_description_content_type: 'text/markdown', author: this.metadata.author.name + ( @@ -1175,9 +1180,32 @@ class Package { package_data: packageData, python_requires: '>=3.6', install_requires: [`jsii~=${jsiiVersionSimple}`, 'publication>=0.0.3'].concat(dependencies), + classifiers: [ + 'Intended Audience :: Developers', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 3', + ], }; /* eslint-enable @typescript-eslint/camelcase */ + switch (this.metadata.docs && this.metadata.docs.stability) { + case spec.Stability.Experimental: + setupKwargs.classifiers.push('Development Status :: 4 - Beta'); + break; + case spec.Stability.Stable: + setupKwargs.classifiers.push('Development Status :: 5 - Production/Stable'); + break; + case spec.Stability.Deprecated: + setupKwargs.classifiers.push('Development Status :: 7 - Inactive'); + break; + default: + // No 'Development Status' trove classifier for you! + } + + if (spdxLicenseList[this.metadata.license] && spdxLicenseList[this.metadata.license].osiApproved) { + setupKwargs.classifiers.push('License :: OSI Approved'); + } + // We Need a setup.py to make this Package, actually a Package. // TODO: // - License diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base-of-base/python/setup.py b/packages/jsii-pacmak/test/expected.jsii-calc-base-of-base/python/setup.py index 1e6e7da4f5..863ee9311e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base-of-base/python/setup.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base-of-base/python/setup.py @@ -6,6 +6,7 @@ "name": "scope.jsii-calc-base-of-base", "version": "0.20.2", "description": "An example transitive dependency for jsii-calc.", + "license": "Apache-2.0", "url": "https://github.com/aws/jsii", "long_description_content_type": "text/markdown", "author": "Amazon Web Services", @@ -31,6 +32,12 @@ "install_requires": [ "jsii~=0.20.2", "publication>=0.0.3" + ], + "classifiers": [ + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "License :: OSI Approved" ] } """) diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-base/python/setup.py b/packages/jsii-pacmak/test/expected.jsii-calc-base/python/setup.py index fb8800d33f..640c735d1b 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-base/python/setup.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc-base/python/setup.py @@ -6,6 +6,7 @@ "name": "scope.jsii-calc-base", "version": "0.20.2", "description": "An example direct dependency for jsii-calc.", + "license": "Apache-2.0", "url": "https://github.com/aws/jsii", "long_description_content_type": "text/markdown", "author": "Amazon Web Services", @@ -32,6 +33,12 @@ "jsii~=0.20.2", "publication>=0.0.3", "scope.jsii-calc-base-of-base~=0.20.2" + ], + "classifiers": [ + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "License :: OSI Approved" ] } """) diff --git a/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py b/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py index d9957e25df..dd04aa7091 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc-lib/python/setup.py @@ -6,6 +6,7 @@ "name": "scope.jsii-calc-lib", "version": "0.20.2", "description": "A simple calcuator library built on JSII.", + "license": "Apache-2.0", "url": "https://github.com/aws/jsii", "long_description_content_type": "text/markdown", "author": "Amazon Web Services", @@ -32,6 +33,13 @@ "jsii~=0.20.2", "publication>=0.0.3", "scope.jsii-calc-base~=0.20.2" + ], + "classifiers": [ + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Development Status :: 7 - Inactive", + "License :: OSI Approved" ] } """) diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/python/setup.py b/packages/jsii-pacmak/test/expected.jsii-calc/python/setup.py index 16df87ddca..e0a801490c 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/python/setup.py +++ b/packages/jsii-pacmak/test/expected.jsii-calc/python/setup.py @@ -6,6 +6,7 @@ "name": "jsii-calc", "version": "0.20.2", "description": "A simple calcuator built on JSII.", + "license": "Apache-2.0", "url": "https://github.com/aws/jsii", "long_description_content_type": "text/markdown", "author": "Amazon Web Services", @@ -34,6 +35,13 @@ "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", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Development Status :: 4 - Beta", + "License :: OSI Approved" ] } """)