From 27496e02b844431da3617dec203c726f691d9515 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Wed, 18 Mar 2020 00:00:00 +0000 Subject: [PATCH] python distribute try again --- .gitignore | 5 +++++ MANIFEST.in | 1 - README.adoc | 10 ++++++++-- china-dictatorship.py | 7 +++++++ push-mirrors | 3 +++ setup.py | 18 +++++++++++++++++- 6 files changed, 40 insertions(+), 4 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.gitignore b/.gitignore index b3a1398..ae2fab6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ /*.egg-info/ /build/ /dist/ + +# Tests. +*.tmp +tmp.* +*.tmp.* diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 5710809..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include README.adoc diff --git a/README.adoc b/README.adoc index e31f251..b9693ff 100644 --- a/README.adoc +++ b/README.adoc @@ -4918,9 +4918,15 @@ python -m pip install china-dictatorship china-dictatorship.py > README.html .... -TODO: create an Ubuntu PPA as well. +We later found on Google by chance that libraries.io picked it up and rendered the README nicely as well: https://libraries.io/pypi/china-dictatorship (https://web.archive.org/web/20200318043050/https://libraries.io/pypi/china-dictatorship[archive]). This is why packaging is a good idea. -Update all mirrors with: link:push-mirrors[] +TODO: create an Ubuntu PPA and Ruby gem as well. + +Update all mirrors in one go with: link:push-mirrors[]: + +.... +./push-mirrors +.... == Backlinks to this repository diff --git a/china-dictatorship.py b/china-dictatorship.py index 4265cc3..0a30b6d 100755 --- a/china-dictatorship.py +++ b/china-dictatorship.py @@ -1 +1,8 @@ #!/usr/bin/env python + +import pkg_resources + +readme_html_path = pkg_resources.resource_string(__name__, 'README.html') +print(readme_html_path) +with open(readme_html_path) as f: + print(f.read()) diff --git a/push-mirrors b/push-mirrors index 1f63ad7..52d022b 100755 --- a/push-mirrors +++ b/push-mirrors @@ -4,7 +4,10 @@ set -eux +make + # NPM package. +# Updates package.json version, which other systems read if possible. ./push-mirrors-bump-package-json-version git add package.json git commit -m 'bump package.json' diff --git a/setup.py b/setup.py index 1c29a66..d750785 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,24 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +''' +https://github.com/cirosantilli/china-dictatorship#mirrors +''' + +import json + from setuptools import setup, find_packages +with open('package.json') as f: + package_json = json.load(f) +version = package_json['version'] + setup( name='china-dictatorship', - version='0.0.1', + version=version, description='2018新疆改造中心,1989六四事件,1999法轮功 ,2019 996.ICU, 2018包子露宪,2015 710律师劫,2015巴拿马文件 邓家贵,2017低端人口,2008西藏骚乱', + # Fails with: "The description failed to render in the default format of reStructuredText." + #long_description=readme(), long_description='2018新疆改造中心,1989六四事件,1999法轮功 ,2019 996.ICU, 2018包子露宪,2015 710律师劫,2015巴拿马文件 邓家贵,2017低端人口,2008西藏骚乱', url='https://github.com/cirosantilli/china-dictatorship', author='Ciro Santilli', @@ -14,4 +26,8 @@ setup( packages=find_packages(), include_package_data=True, scripts=['china-dictatorship.py'], + data_files=[ + 'README.adoc', + 'README.html', + ], )