~hristoast/mousikofidi

e5fcb58e7eb35e79ea34eaf7e735f9a8eaca5aec — Hristos N. Triantafillou 1 year, 7 months ago 1a76986
Expand setup.py, add PyPI deploy tools

* The debian build will now run a script that will, on a git tag push,
  use `twine` to upload MousikóFídi to PyPI.
* .gitignore and clean targets updated to reflect new stuff.
* dev requirements are also updated with new things for building and
  publishing.
* A small shell script to check that 1) there's no local changes, and
  2) it's a git tag commit.  If both, then a package upload is
  performed.
6 files changed, 80 insertions(+), 3 deletions(-)

M .builds/debian.yml
M .gitignore
M Makefile
M dev-requirements.txt
A pypi-upload.sh
M setup.py
M .builds/debian.yml => .builds/debian.yml +5 -0
@@ 3,6 3,8 @@ packages:
  # - npm
  - python3-pip
  - python3-yaml
secrets:
  - 688f0848-0393-48ae-af1a-5403c0bd45d8
sources:
  - https://git.sr.ht/~hristoast/mousikofidi
tasks:


@@ 35,3 37,6 @@ tasks:
  - test-install: |
      cd mousikofidi
      make install
  - upload-to-pypi: |
      cd mousikofidi
      ./pypi-upload.sh

M .gitignore => .gitignore +3 -0
@@ 8,3 8,6 @@ __pycache__
auto-save-list
tramp
.\#*
MousikoFidi.egg-info
build/
dist/

M Makefile => Makefile +16 -1
@@ 3,7 3,11 @@ proj_dir := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
.DEFAULT_GOAL:= server

clean:
	rm -fr $(proj_dir)/__pycache__ $(proj_dir)/mousikofidi/__pycache__ $(proj_dir)/.pytest_cache
	rm -fr $(proj_dir)/__pycache__ \
    $(proj_dir)/mousikofidi/__pycache__ \
    $(proj_dir)/.pytest_cache \
    $(proj_dir)/MousikoFidi.egg-info \
    $(proj_dir)/build $(proj_dir)/dist

install:
	pip3 install --user --upgrade $(proj_dir)


@@ 14,6 18,17 @@ install-global:
uninstall:
	pip3 uninstall MousikoFidi

distribution-archive:
	cd $(proj_dir) && python3 setup.py sdist bdist_wheel

upload-distribution-archive-test:
	test -d $(proj_dir)/dist || exit 1
	cd $(proj_dir) && twine upload --repository-url https://test.pypi.org/legacy/ dist/*

upload-distribution-archive:
	@test -d $(proj_dir)/dist || exit 1
	cd $(proj_dir) && twine upload dist/*

minify-css:
	yuicompressor --type css $(proj_dir)/mousikofidi/static/css/fidi.css -o $(proj_dir)/mousikofidi/static/css/fidi.min.css --charset utf-8
	yuicompressor --type css $(proj_dir)/mousikofidi/static/css/fidi-nes.css -o $(proj_dir)/mousikofidi/static/css/fidi-nes.min.css --charset utf-8

M dev-requirements.txt => dev-requirements.txt +2 -0
@@ 1,3 1,5 @@
black==19.3b0
flake8==3.6.0
pytest==5.0.1
twine-1.14.0
wheel==0.33.6

A pypi-upload.sh => pypi-upload.sh +18 -0
@@ 0,0 1,18 @@
#!/bin/bash

if git diff-index --quiet HEAD --; then
    if git describe --exact-match --tags HEAD -- 2>/dev/null; then
        cat <<EOF > ~/.pypirc
[pypi]
username = __token__
password = $(cat ~/.fidipypi)
EOF
        make upload-distribution-archive
    else
        echo This is not a tag!  Exiting...
    exit 0
    fi
else
    echo Local changes detected!  Exiting...
    exit 0
fi

M setup.py => setup.py +36 -2
@@ 16,12 16,46 @@
from setuptools import setup


with open("README.md", "r") as r:
    long_desc = r.read()

setup(
    name="MousikoFidi",
    version="0.15",
    long_description=__doc__,
    version="0.16",
    author="Hristos N. Triantafillou",
    author_email="me@hristos.co",
    description="MousikóFídi: Your Music Cloud",
    long_description=long_desc,
    long_description_content_type="text/markdown",
    url="https://git.sr.ht/~hristoast/mousikofidi",
    packages=["mousikofidi"],
    include_package_data=True,
    zip_safe=False,
    classifiers=[
        "Development Status :: 4 - Beta",
        "Environment :: Web Environment",
        "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
        "License :: OSI Approved",
        "Natural Language :: English",
        "Operating System :: POSIX :: Linux",
        "Programming Language :: JavaScript",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3 :: Only",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: Implementation :: CPython",
        "Topic :: Internet :: WWW/HTTP",
        "Topic :: Internet :: WWW/HTTP :: Browsers",
        "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Content Management System",
        "Topic :: Multimedia",
        "Topic :: Multimedia :: Sound/Audio",
        "Topic :: Multimedia :: Sound/Audio :: Mixers",
        "Topic :: Multimedia :: Sound/Audio :: Players",
        "Topic :: Multimedia :: Sound/Audio :: Players :: MP3",
        "Topic :: Multimedia :: Video",
        "Topic :: Multimedia :: Video :: Display",
    ],
    install_requires=["Flask==1.0.3", "mutagen==1.42.0", "uWSGI==2.0.18"],
    python_requires=">=3.4",
)