aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2019-06-23 22:17:47 +0000
committerMike Crute <mike@crute.us>2019-06-23 22:17:47 +0000
commit063fce47d6c6e096d1de955bdecf6f25783988ca (patch)
tree2bc2249fd8be6a5ea7e5b7250934bbe44e34ceb7
parent1710880bd44fe0e6fa95b7dfe01926941c0df991 (diff)
downloadpydora-063fce47d6c6e096d1de955bdecf6f25783988ca.tar.bz2
pydora-063fce47d6c6e096d1de955bdecf6f25783988ca.tar.xz
pydora-063fce47d6c6e096d1de955bdecf6f25783988ca.zip
Convert release script to python
-rwxr-xr-xrelease.sh20
-rwxr-xr-xsetup.py41
2 files changed, 41 insertions, 20 deletions
diff --git a/release.sh b/release.sh
deleted file mode 100755
index be6fab6..0000000
--- a/release.sh
+++ /dev/null
@@ -1,20 +0,0 @@
1#!/bin/bash
2
3[ -e .release ] && rm -rf .release
4mkdir .release
5
6# Setup Python 3 Environment
7python3 -m venv .release/py3
8.release/py3/bin/pip install -U pip setuptools virtualenv twine
9
10echo "Building Python 3 Artifact"
11.release/py3/bin/python setup.py release bdist_wheel --python-tag py3
12
13echo "Building Source Dist Artifact"
14.release/py3/bin/python setup.py sdist
15
16# Upload it all
17.release/py3/bin/twine upload dist/*
18
19# Cleanup
20rm -rf .release
diff --git a/setup.py b/setup.py
index 9c75eb1..e9b1df2 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,10 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2 2
3import os
4import shutil
5import subprocess
6from distutils import log
7from distutils.core import Command
3from setuptools.command.test import test 8from setuptools.command.test import test
4from setuptools import setup, find_packages 9from setuptools import setup, find_packages
5 10
@@ -21,6 +26,41 @@ class TestsWithCoverage(test):
21 cov.html_report() 26 cov.html_report()
22 27
23 28
29class PyPiReleaseCommand(Command):
30
31 user_options = []
32 description = "build and release artifacts to pypi"
33
34 def initialize_options(self):
35 pass
36
37 def finalize_options(self):
38 pass
39
40 def pip_install(self, *pkgs):
41 subprocess.check_call((".release/py3/bin/pip", "install", "-U") + pkgs)
42
43 def run(self):
44 if not os.path.exists(".release"):
45 log.info("Creating temp release tree")
46 os.mkdir(".release")
47
48 subprocess.check_call(["python3", "-m", "venv", ".release/py3"])
49 self.pip_install("pip", "setuptools", "virtualenv", "twine")
50
51 log.info("Building Python 3 Artifact")
52 subprocess.check_call([
53 ".release/py3/bin/python",
54 "setup.py", "release", "bdist_wheel", "--python-tag", "py3"])
55
56 log.info("Building Source Dist Artifact")
57 subprocess.check_call([".release/py3/bin/python", "setup.py", "sdist"])
58 subprocess.check_call([".release/py3/bin/twine", "upload", "dist/*"])
59
60 log.info("Cleaning up temp release tree")
61 shutil.rmtree(".release")
62
63
24setup( 64setup(
25 name="pydora", 65 name="pydora",
26 version="2.0.0", 66 version="2.0.0",
@@ -33,6 +73,7 @@ setup(
33 packages=find_packages(exclude=["tests", "tests.*"]), 73 packages=find_packages(exclude=["tests", "tests.*"]),
34 cmdclass={ 74 cmdclass={
35 "test": TestsWithCoverage, 75 "test": TestsWithCoverage,
76 "pypi_release": PyPiReleaseCommand,
36 }, 77 },
37 entry_points={ 78 entry_points={
38 "console_scripts": [ 79 "console_scripts": [