diff --git a/services/pypi/pypi-status.service.js b/services/pypi/pypi-status.service.js index 769c376c57fd4..0ba95bd1412a8 100644 --- a/services/pypi/pypi-status.service.js +++ b/services/pypi/pypi-status.service.js @@ -28,6 +28,7 @@ export default class PypiStatus extends PypiBase { stable: 'brightgreen', mature: 'brightgreen', inactive: 'red', + unknown: 'lightgrey', }[status] return { @@ -48,7 +49,7 @@ export default class PypiStatus extends PypiBase { // - Development Status :: 6 - Mature // - Development Status :: 7 - Inactive // https://pypi.org/pypi?%3Aaction=list_classifiers - const status = parseClassifiers( + let status = parseClassifiers( packageData, /^Development Status :: (\d - \S+)$/, ) @@ -57,6 +58,10 @@ export default class PypiStatus extends PypiBase { .map(classifier => classifier.replace(/production\/stable/i, 'stable')) .pop() + if (!status) { + status = 'Unknown' + } + return this.constructor.render({ status }) } } diff --git a/services/pypi/pypi-status.tester.js b/services/pypi/pypi-status.tester.js index 764254fe0eba6..e2f32bb8e94b3 100644 --- a/services/pypi/pypi-status.tester.js +++ b/services/pypi/pypi-status.tester.js @@ -13,6 +13,10 @@ t.create('status (valid, beta)') .get('/django/2.0rc1.json') .expectBadge({ label: 'status', message: 'beta' }) +t.create('status (status not specified)') + .get('/arcgis2geojson/3.0.2.json') + .expectBadge({ label: 'status', message: 'unknown' }) + t.create('status (invalid)') .get('/not-a-package.json') .expectBadge({ label: 'status', message: 'package or version not found' })