-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile.pypi
23 lines (21 loc) · 1.93 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
# -*- mode: Makefile -*-
# This file contains rules to update the jianpu-ly PyPI package.
# It is run automatically by my homepage update scripts before a commit.
# Current limitations: if I've merged a pull request from another contributor, unless I'm making follow-on changes this will need a manual `make -f Makefile.pypi update-jianpuly-pypi` I have to remember to do.
check-if-jianpuly-version-is-changing: test
if (git diff;git diff --staged)|grep '^[+]# v[0-9]'; then make -f Makefile.pypi update-jianpuly-pypi; else true; fi
test:
@if grep '^# v[0-9][^.]*[.][0-9][0-9][0-9][0-9]' jianpu-ly.py; 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
update-jianpuly-pypi:
mkdir jianpu_ly
cp jianpu-ly.py jianpu_ly/__init__.py
echo "import jianpu_ly;jianpu_ly.main()" > jianpu_ly/__main__.py
echo "from setuptools import setup, find_packages;setup(name='jianpu_ly',version='$$(python3 jianpu-ly.py --version 2>&1|sed -e 's/[^ ]* v//' -e 's/ .*//' -e 's/[.][1-9]$$/&0/' -e 's/[.][0-9][0-9]$$/&0/')',entry_points={'console_scripts':['jianpu-ly=jianpu_ly.__init__:main']},license='Apache 2',platforms='any',url='http://ssb22.user.srcf.net/mwrhome/jianpu-ly.html',author='Silas S. Brown',author_email='ssb$$(echo 22@ca)m.ac.uk',description='Jianpu in Lilypond',long_description=r'''$$(grep -v 'also mirrored' < 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.6')" > setup.py
mv README.md .. # or it'll override our altered version
python3 setup.py sdist
twine upload dist/*
mv ../README.md .
rm -r jianpu_ly.egg-info dist jianpu_ly setup.py
.PHONY: check-if-jianpuly-version-is-changing
.PHONY: update-jianpuly-pypi
.PHONY: test