From 338194504fc6121a56c5603a3560ed8f497ce25f Mon Sep 17 00:00:00 2001 From: Danny Grove Date: Sat, 29 Jun 2019 01:31:25 -0700 Subject: [PATCH] Removing pyinstaller for setup.py. Prepping for push to pypi and getting into repositories * Move version checking to top of makefile to be injected * Move to using setup.py --version to get version in circleci * Always build the binaries so they can be manually tested if needed --- .circleci/config.yml | 65 ++++-------------------------------------- Makefile | 5 ++-- Pipfile | 1 - Pipfile.lock | 35 +---------------------- mtls.spec | 67 -------------------------------------------- mtls/__init__.py | 6 ++-- 6 files changed, 12 insertions(+), 167 deletions(-) delete mode 100644 mtls.spec diff --git a/.circleci/config.yml b/.circleci/config.yml index 9874c01..f28ee3a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,23 +80,20 @@ jobs: name: Setup command: | make setup - mkdir output - persist_to_workspace: root: ~/mtls-cli paths: - .coveragerc - .git/* - .tmp/* - - bin + - bin/* - Makefile - Pipfile - Pipfile.lock - README.md - build/* - dist/* - - mtls.spec - mtls/**/* - - output/* - password_word_list - requirements.txt - scripts/* @@ -114,47 +111,6 @@ jobs: name: Lint command: make lint - build-package-linux: - executor: linux - working_directory: ~/mtls-cli - steps: - - attach_workspace: - at: ~/mtls-cli - - pip_install - - run: - name: Package - command: | - make pkg SIGN=0 - mkdir -p output - mv "mtls-Linux-$(cat VERSION).tar.gz" output/ - - run: - name: Test Packaged mtls - command: make run-build - - store_artifacts: - path: output/ - - build-package-macos: - executor: osx - working_directory: ~/mtls-cli - steps: - - attach_workspace: - at: ~/mtls-cli - - brew - - pip_install: - dir: /Users/distiller/.local/share/virtualenvs/ - key: osx - - run: - name: Package - command: | - make pkg SIGN=0 - mkdir -p output - mv "mtls-Darwin-$(cat VERSION).tar.gz" output/ - - run: - name: Test Packaged mtls - command: make run-build - - store_artifacts: - path: output/ - build-package-pypi: executor: linux working_directory: ~/mtls-cli @@ -167,7 +123,7 @@ jobs: command: pipenv lock -r > requirements.txt - run: name: Create Distribution - command: make pgk-pypy + command: make pkg-pypi - store_artifacts: path: dist/ @@ -228,7 +184,7 @@ workflows: - lint: <<: *filter_all_tags requires: - - init + - init # - test: # <<: *filter_all_tags # requires: @@ -237,18 +193,7 @@ workflows: # <<: *filter_all_tags # requires: # - init - - build-package-linux: - <<: *filter_only_tags - requires: - - lint - # - test - - build-package-macos: - <<: *filter_only_tags - requires: - - lint - # - test-macos - build-package-pypi: - <<: *filter_only_tags + <<: *filter_all_tags requires: - - build-package-linux - - build-package-macos + - lint diff --git a/Makefile b/Makefile index a2caad4..c588e43 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ PIP_ENV:=$(shell pipenv --venv) ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) DESTDIR ?= ~/.local/bin/ SIGN := 1 +VERSION := $(shell pipenv run python3 setup.py --version) ifeq ($(OS),Windows_NT) UNAME := Windows @@ -53,7 +54,7 @@ build: setup @pipenv run python setup.py build run: - @$(PIP_ENV)/bin/python3 cli.py $(ARGS) + @pipenv run python3 bin/mtls $(ARGS) run-build: @./mtls-$(UNAME)/mtls $(ARGS) @@ -78,7 +79,7 @@ ifeq ($(SIGN), 1) @echo "Signing binary" @gpg --sign --detach-sign --output mtls-$(UNAME)/mtls.sig mtls-$(UNAME)/mtls endif - @tar -zcvf mtls-$(UNAME)-$$(cat VERSION).tar.gz mtls-$(UNAME) + @tar -zcvf mtls-$(UNAME)-$(VERSION).tar.gz mtls-$(UNAME) pkg-pypi: build @pipenv run python setup.py sdist bdist_wheel diff --git a/Pipfile b/Pipfile index 7be0320..28bfddb 100644 --- a/Pipfile +++ b/Pipfile @@ -4,7 +4,6 @@ url = "https://pypi.org/simple" verify_ssl = true [dev-packages] -PyInstaller = "==3.4" black = "==19.3b0" pycodestyle = "==2.5.0" coverage = "==4.5.2" diff --git a/Pipfile.lock b/Pipfile.lock index af21f27..69c46f6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "457ea68ddabd15995f13ab00a9fdb40d7a1b5f0d0048b317440f301e335acd94" + "sha256": "0ba45462934bad1207bec9734f0cf9e1e13ecb8cb5c56cea30f0d72f98e4c010" }, "pipfile-spec": 6, "requires": {}, @@ -163,13 +163,6 @@ } }, "develop": { - "altgraph": { - "hashes": [ - "sha256:d6814989f242b2b43025cba7161fc1b8fb487a62cd49c49245d6fd01c18ac997", - "sha256:ddf5320017147ba7b810198e0b6619bd7b5563aa034da388cea8546b877f9b0c" - ], - "version": "==0.16.1" - }, "appdirs": { "hashes": [ "sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92", @@ -280,12 +273,6 @@ ], "version": "==0.6.2" }, - "future": { - "hashes": [ - "sha256:67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8" - ], - "version": "==0.17.1" - }, "idna": { "hashes": [ "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", @@ -293,19 +280,6 @@ ], "version": "==2.8" }, - "macholib": { - "hashes": [ - "sha256:ac02d29898cf66f27510d8f39e9112ae00590adb4a48ec57b25028d6962b1ae1", - "sha256:c4180ffc6f909bf8db6cd81cff4b6f601d575568f4d5dee148c830e9851eb9db" - ], - "version": "==1.11" - }, - "pefile": { - "hashes": [ - "sha256:a5d6e8305c6b210849b47a6174ddf9c452b2888340b8177874b862ba6c207645" - ], - "version": "==2019.4.18" - }, "pycodestyle": { "hashes": [ "sha256:cbc619d09254895b0d12c2c691e237b2e91e9b2ecf5e84c26b35400f93dcfb83", @@ -314,13 +288,6 @@ "index": "pypi", "version": "==2.4.0" }, - "pyinstaller": { - "hashes": [ - "sha256:a5a6e04a66abfcf8761e89a2ebad937919c6be33a7b8963e1a961b55cb35986b" - ], - "index": "pypi", - "version": "==3.4" - }, "requests": { "hashes": [ "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", diff --git a/mtls.spec b/mtls.spec deleted file mode 100644 index 0af5a3b..0000000 --- a/mtls.spec +++ /dev/null @@ -1,67 +0,0 @@ -# -*- mode: python -*- -import os -import sys -import importlib - -block_cipher = None - -import PyInstaller.config - -# Longer paths precede shorter paths for path-stripping. -env_paths = [] -if 'VIRTUAL_ENV' in os.environ: - env_paths.append( - os.path.join( - os.environ['VIRTUAL_ENV'], - 'lib', - 'python3.6', - 'site-packages' - ) - ) - env_paths.append( - os.path.join( - os.environ['VIRTUAL_ENV'], - 'lib', - 'python3.7', - 'site-packages' - ) - ) - -env_paths.append('.') - -a = Analysis([ - 'bin/mtls' - ], - pathex=env_paths, - datas=[ - ('mtls/share/password_word_list', 'mtls/share') - ], - hookspath=None, - runtime_hooks=None, - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False -) - -pyz = PYZ( - a.pure, - a.zipped_data, - cipher=block_cipher -) - -exe = EXE( - pyz, - a.scripts, - a.binaries, - a.zipfiles, - a.datas, - [], - name='mtls', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - console=True -) diff --git a/mtls/__init__.py b/mtls/__init__.py index 92f8f45..c14d454 100644 --- a/mtls/__init__.py +++ b/mtls/__init__.py @@ -5,13 +5,13 @@ __author__ = "Danny Grove " -# Allows "import mtls" and "from mtls import ". -sys.path.extend([os.path.join(os.path.dirname(__file__), "..")]) - try: __version__ = get_distribution(__name__).version except DistributionNotFound: __version__ = "dev" +# Allows "import mtls" and "from mtls import ". +sys.path.extend([os.path.join(os.path.dirname(__file__), "..")]) + from .cli import cli # noqa from .mtls import MutualTLS # noqa