python getting closer
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -4,11 +4,17 @@
|
|||||||
/README
|
/README
|
||||||
|
|
||||||
# Python distribution/packaging.
|
# Python distribution/packaging.
|
||||||
|
*.pyc
|
||||||
/*.egg-info/
|
/*.egg-info/
|
||||||
/build/
|
/build/
|
||||||
/dist/
|
/dist/
|
||||||
|
__pycache__
|
||||||
|
|
||||||
# Tests.
|
# Tests.
|
||||||
*.tmp
|
*.tmp
|
||||||
tmp.*
|
tmp.*
|
||||||
*.tmp.*
|
*.tmp.*
|
||||||
|
|
||||||
|
# For stupid packaging systems that require subdirectories.
|
||||||
|
/china_dictatorship/README.adoc
|
||||||
|
/china_dictatorship/README.html
|
||||||
|
|||||||
@@ -4914,7 +4914,7 @@ This would force China to also block package managers to block this repo.
|
|||||||
We managed to upload a Python PyPi package at: https://pypi.org/project/china-dictatorship/ but TODO needs implementing now. Usage will be as:
|
We managed to upload a Python PyPi package at: https://pypi.org/project/china-dictatorship/ but TODO needs implementing now. Usage will be as:
|
||||||
|
|
||||||
....
|
....
|
||||||
python -m pip install --user --upgrade china-dictatorship
|
python3 -m pip install --user --upgrade china-dictatorship
|
||||||
china-dictatorship.py > README.html
|
china-dictatorship.py > README.html
|
||||||
....
|
....
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
readme_html_path = pkg_resources.resource_string(__name__, 'README.html')
|
readme_html_path = pkg_resources.resource_filename('china_dictatorship', 'README.html')
|
||||||
print(readme_html_path)
|
|
||||||
with open(readme_html_path) as f:
|
with open(readme_html_path) as f:
|
||||||
print(f.read())
|
print(f.read())
|
||||||
|
|||||||
@@ -21,5 +21,5 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublishOnly": "cp README.adoc README;make"
|
"prepublishOnly": "cp README.adoc README;make"
|
||||||
},
|
},
|
||||||
"version": "0.0.8"
|
"version": "0.0.17"
|
||||||
}
|
}
|
||||||
|
|||||||
15
push-mirrors
15
push-mirrors
@@ -9,18 +9,23 @@ make
|
|||||||
# NPM package.
|
# NPM package.
|
||||||
# Updates package.json version, which other systems read if possible.
|
# Updates package.json version, which other systems read if possible.
|
||||||
./push-mirrors-bump-package-json-version
|
./push-mirrors-bump-package-json-version
|
||||||
git add package.json
|
#npm publish
|
||||||
git commit -m 'bump package.json'
|
#git add package.json
|
||||||
git push
|
|
||||||
npm publish
|
|
||||||
|
|
||||||
# Python package.
|
# Python package.
|
||||||
# Initial one time setup.
|
# Initial one time setup.
|
||||||
#python -m pip install --user setuptools wheel twine
|
#python -m pip install --user setuptools wheel twine
|
||||||
|
./push-mirrors-bump-setup-py-version
|
||||||
|
cp README.adoc README.html china_dictatorship
|
||||||
python setup.py sdist bdist_wheel
|
python setup.py sdist bdist_wheel
|
||||||
# Asks for password every time.
|
# Asks for username and password every time, unless you setup ~/.pypirc.
|
||||||
twine upload dist/*
|
twine upload dist/*
|
||||||
rm -rf build dist *.egg-info
|
rm -rf build dist *.egg-info
|
||||||
|
#git add setup.py
|
||||||
|
|
||||||
|
# Bump package versions
|
||||||
|
#git commit -m 'bump package version'
|
||||||
|
#git push
|
||||||
|
|
||||||
git push git@gitlab.com:cirosantilli/china-dictatorship.git
|
git push git@gitlab.com:cirosantilli/china-dictatorship.git
|
||||||
git push git@bitbucket.org:cirosantilli/china-dictatorship.git
|
git push git@bitbucket.org:cirosantilli/china-dictatorship.git
|
||||||
|
|||||||
28
push-mirrors-bump-setup-py-version
Executable file
28
push-mirrors-bump-setup-py-version
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
'''
|
||||||
|
https://github.com/cirosantilli/china-dictatorship#mirrors
|
||||||
|
'''
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
with open('package.json') as f:
|
||||||
|
package_json = json.load(f)
|
||||||
|
version_string = package_json['version']
|
||||||
|
version_re = re.compile(" version='0.0.\d+'")
|
||||||
|
with open('setup.py', 'r') as f:
|
||||||
|
setup_py_lines = f.readlines()
|
||||||
|
setup_py_new_lines = []
|
||||||
|
for line in setup_py_lines:
|
||||||
|
line = line.rstrip()
|
||||||
|
match = version_re.match(line)
|
||||||
|
if match:
|
||||||
|
setup_py_new_lines.append(" version='{}',".format(version_string))
|
||||||
|
else:
|
||||||
|
setup_py_new_lines.append(line)
|
||||||
|
setup_py_new_string = '\n'.join(setup_py_new_lines) + '\n'
|
||||||
|
with open('setup.py', 'w') as f:
|
||||||
|
f.write(setup_py_new_string)
|
||||||
14
setup.py
14
setup.py
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@@ -9,13 +9,9 @@ import json
|
|||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
with open('package.json') as f:
|
|
||||||
package_json = json.load(f)
|
|
||||||
version = package_json['version']
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='china-dictatorship',
|
name='china-dictatorship',
|
||||||
version=version,
|
version='0.0.17',
|
||||||
description='2018新疆改造中心,1989六四事件,1999法轮功 ,2019 996.ICU, 2018包子露宪,2015 710律师劫,2015巴拿马文件 邓家贵,2017低端人口,2008西藏骚乱',
|
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."
|
# Fails with: "The description failed to render in the default format of reStructuredText."
|
||||||
#long_description=readme(),
|
#long_description=readme(),
|
||||||
@@ -26,8 +22,6 @@ setup(
|
|||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
scripts=['china-dictatorship.py'],
|
scripts=['china-dictatorship.py'],
|
||||||
data_files=[
|
# data_files=['README.adoc', 'README.html'],
|
||||||
'README.adoc',
|
package_data={'china_dictatorship': ['README.adoc', 'README.html']},
|
||||||
'README.html',
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user