-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.pypi
50 lines (50 loc) · 5.61 KB
/
Makefile.pypi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- mode: Makefile -*-
all: check-if-adjuster-version-is-changing check-if-annogen-version-is-changing check-if-termlayout-version-is-changing
check-if-adjuster-version-is-changing:
@if python3 adjuster.py --version|grep 'v[0-9][^.]*[.][0-9][0-9][0-9][0-9]'; then echo "4+ decimal digits in version number will now need another -e 's/[.][0-9][0-9][0-9]$$/&0/' in Makefile.pypi's sed expression"; false; fi
if (git diff;git diff --staged)|grep '^[+]"Web Adjuster v[0-9]'; then make -f Makefile.pypi update-adjuster-pypi; else true; fi
check-if-annogen-version-is-changing:
@if python3 annogen.py --version|grep 'v[0-9][^.]*[.][0-9][0-9][0-9][0-9]'; then echo "4+ decimal digits in version number will now need another -e 's/[.][0-9][0-9][0-9]$$/&0/' in Makefile.pypi's sed expression"; false; fi
if (git diff;git diff --staged)|grep '^[+]"Annotator Generator v[0-9]'; then make -f Makefile.pypi update-annogen-pypi; else true; fi
check-if-termlayout-version-is-changing:
@if python3 termlayout.py --version|grep 'v[0-9][^.]*[.][0-9][0-9][0-9]'; then echo "3+ decimal digits in version number will now need another -e 's/[.][0-9][0-9]$$/&0/' in Makefile.pypi's sed expression"; false; fi
if (git diff;git diff --staged)|grep '^[+]"TermLayout v[0-9]'; then make -f Makefile.pypi update-termlayout-pypi; else true; fi
update-all-pypi: update-adjuster-pypi update-annogen-pypi update-termlayout-pypi
update-adjuster-pypi:
mkdir adjuster
cp adjuster.py adjuster/__init__.py
echo "import adjuster;adjuster.main()" > adjuster/__main__.py
echo "from setuptools import setup, find_packages;setup(name='adjuster',version='$$(python3 adjuster.py --version|head -1|sed -e 's/[^v]*v//' -e 's/ .*//' -e 's/[.][1-9]$$/&0/' -e 's/[.][0-9][0-9]$$/&0/')',entry_points={'console_scripts':['adjuster=adjuster.__init__:main']},license='Apache 2',platforms='any',url='http://ssb22.user.srcf.net/adjuster/',author='Silas S. Brown',author_email='ssb$$(echo 22@ca)m.ac.uk',description='the Web Adjuster domain-rewriting proxy',long_description=r'''$$(awk 'BEGIN{p=0} /^Web Adjuster$$/ {p=1} /^Installation$$/ {p=0} /^Options for Web Adjuster/ {p=1} /^Options for Annotator Generator/ {p=0} //{if(p) print}' < README.md)''',long_description_content_type='text/markdown',packages=find_packages(),classifiers=['Programming Language :: Python :: 2','Programming Language :: Python :: 3','License :: OSI Approved :: Apache Software License','Operating System :: OS Independent'],python_requires='>=2.5',install_requires=['tornado'])" > setup.py
mv README.md .. # or it'll override our altered version
python3 setup.py sdist
twine upload dist/*
mv ../README.md .
rm -r adjuster.egg-info dist adjuster setup.py
update-annogen-pypi:
mkdir annogen
echo '"""Annotator Generator is an application, not a library. You can run it with "python -m annogen --help" to see the options."""'> annogen/__init__.py
cp annogen.py annogen/__main__.py
echo "def placebo(): pass # for setuptools entry_points" >> annogen/__main__.py # because there's no main()
echo "from setuptools import setup, find_packages;setup(name='annogen',version='$$(python3 annogen.py --version|head -1|sed -e 's/[^v]*v//' -e 's/ .*//' -e 's/[.][1-9]$$/&0/' -e 's/[.][0-9][0-9]$$/&0/')',entry_points={'console_scripts':['annogen=annogen.__main__:placebo']},license='Apache 2',platforms='any',url='http://ssb22.user.srcf.net/adjuster/annogen.html',author='Silas S. Brown',author_email='ssb$$(echo 22@ca)m.ac.uk',description='Annotator Generator, an examples-driven generator of fast text annotators for language learning aids etc',long_description=r'''$$(awk 'BEGIN{p=0} /^Annotator Generator$$/ {p=1} /^TermLayout$$/ {p=0} /^Options for Annotator Generator/ {p=1} /^Copyright and Trademarks/ {p=0} //{if(p) print}' < README.md)''',long_description_content_type='text/markdown',packages=find_packages(),classifiers=['Programming Language :: Python :: 2','Programming Language :: Python :: 3','License :: OSI Approved :: Apache Software License','Operating System :: OS Independent'],python_requires='>=2.7')" > setup.py
mv README.md .. # or it'll override our altered version
python3 setup.py sdist
twine upload dist/*
mv ../README.md .
rm -r annogen.egg-info dist annogen setup.py
update-termlayout-pypi:
mkdir termlayout
cp termlayout.py termlayout/__init__.py
echo "import termlayout;termlayout.main()" > termlayout/__main__.py
echo "from setuptools import setup, find_packages;setup(name='termlayout',version='$$(python3 termlayout.py --version|head -1|sed -e 's/[^v]*v//' -e 's/ .*//' -e 's/[.][1-9]$$/&0/')',entry_points={'console_scripts':['termlayout=termlayout.__init__:main']},license='Apache 2',platforms='any',url='http://ssb22.user.srcf.net/adjuster/termlayout.html',author='Silas S. Brown',author_email='ssb$$(echo 22@ca)m.ac.uk',description='text-mode HTML formatter for Unix terminals, supports ruby, tables, wide characters etc',long_description=r'''$$(awk 'BEGIN{p=0} /^TermLayout$$/ {p=1} /^Options for Web Adjuster/ {p=0} //{if(p) print}' < README.md)''',long_description_content_type='text/markdown',packages=find_packages(),classifiers=['Programming Language :: Python :: 2','Programming Language :: Python :: 3','License :: OSI Approved :: Apache Software License','Operating System :: OS Independent'],python_requires='>=2.3')" > setup.py
mv README.md .. # or it'll override our altered version
python3 setup.py sdist
twine upload dist/*
mv ../README.md .
rm -r termlayout.egg-info dist termlayout setup.py
.PHONY: check-if-adjuster-version-is-changing
.PHONY: update-adjuster-pypi
.PHONY: check-if-annogen-version-is-changing
.PHONY: update-annogen-pypi
.PHONY: check-if-termlayout-version-is-changing
.PHONY: update-termlayout-pypi
.PHONY: update-all-pypi all