summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2018-01-10 11:15:53 -0800
committerBob Ippolito <bob@redivi.com>2018-01-10 11:15:53 -0800
commit6252bc30158828410c30d9831d6f8cd5aa269f08 (patch)
tree972d7fd19c2640dfbadd3482d53a698c3f507624
parentd31e06ed1c6a29f7e5d263927bb8088eea0edc41 (diff)
downloadxattr-6252bc30158828410c30d9831d6f8cd5aa269f08.tar.gz
updates to build plan and script
-rw-r--r--.travis.yml5
-rwxr-xr-x.travis/run.sh3
-rwxr-xr-xscripts/artifacts.py50
3 files changed, 42 insertions, 16 deletions
diff --git a/.travis.yml b/.travis.yml
index 7329b35..ebd7c1e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,6 +7,7 @@ matrix:
include:
- os: osx
language: objective-c
+ env: BUILD_SDIST=true
- os: osx
language: objective-c
env: PYENV_VERSION=pypy3.5-5.10.0
@@ -30,7 +31,9 @@ deploy:
provider: releases
api_key:
secure: Z5m7K1UVq0812nNtR+QAkUE3lxUwhMjM3EDWUOyPmfh0rmOsU2RgQ8oBfT1vatYfY8ExnrG4rRNWmwUqPEIzZmRLmw9zv+ixA3gcVPn6WbbMkwoeIurOPsC9wjgCckDFKYhMda8a92FSL2hVto3JPcRNTZnsKBR35Queray55SM=
- file: dist/*.whl
+ file:
+ - dist/*.whl
+ - dist/*.tar.gz
file_glob: true
on:
repo: xattr/xattr
diff --git a/.travis/run.sh b/.travis/run.sh
index 3c1a219..5337e7a 100755
--- a/.travis/run.sh
+++ b/.travis/run.sh
@@ -17,3 +17,6 @@ python setup.py test
if [[ -n "$PYENV_VERSION" && $TRAVIS_OS_NAME == 'osx' ]]; then
python setup.py bdist_wheel
fi
+if [[ $BUILD_SDIST == 'true' ]]; then
+ python setup.py sdist
+fi
diff --git a/scripts/artifacts.py b/scripts/artifacts.py
index bdcab7b..5490e29 100755
--- a/scripts/artifacts.py
+++ b/scripts/artifacts.py
@@ -1,16 +1,11 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
+from urllib.request import urlopen
-try:
- from urllib.request import urlopen
-except ImportError:
- from urllib import urlopen
-
-import io
import json
import os
-import re
import subprocess
import sys
+import getpass
def get_json(url):
@@ -29,22 +24,43 @@ def download_github_artifacts():
for asset in release['assets']:
download_file(asset['browser_download_url'], 'dist/{name}'.format(**asset))
+
def get_version():
return subprocess.check_output([sys.executable, 'setup.py', '--version']).strip()
+
def artifact_matcher(version):
- return re.compile('^xattr-{}.*\\.(exe|whl)$'.format(re.escape(version)))
+ prefix = 'simplejson-{}'.format(version)
+ def matches(fn):
+ return (
+ fn.startswith(prefix) and
+ os.path.splitext(fn)[1] in ('.exe', '.whl') and
+ not fn.endswith('-none-any.whl')
+ ) or fn == '{}.tar.gz'.format(prefix)
+ return matches
+
def sign_artifacts(version):
artifacts = set(os.listdir('dist'))
- pattern = artifact_matcher(version)
+ matches = artifact_matcher(version)
+ passphrase = getpass.getpass('\nGPG Passphrase:')
for fn in artifacts:
- if pattern.search(fn) and '{}.asc'.format(fn) not in artifacts:
- sign_artifact(os.path.join('dist', fn))
+ if matches(fn) and '{}.asc'.format(fn) not in artifacts:
+ sign_artifact(os.path.join('dist', fn), passphrase)
+
+
+def sign_artifact(path, passphrase):
+ cmd = [
+ 'gpg',
+ '--detach-sign',
+ '--batch',
+ '--passphrase-fd', '0',
+ '--armor',
+ path
+ ]
+ print(' '.join(cmd))
+ subprocess.run(cmd, check=True, input=passphrase, encoding='utf8')
-def sign_artifact(path):
- print(' '.join(['gpg', '--detach-sign', '-a', path]))
- subprocess.check_call(['gpg', '--detach-sign', '-a', path])
def upload_artifacts(version):
artifacts = set(os.listdir('dist'))
@@ -57,6 +73,10 @@ def upload_artifacts(version):
subprocess.check_call(args)
def main():
+ try:
+ os.makedirs('dist')
+ except OSError:
+ pass
download_github_artifacts()
version = get_version()
sign_artifacts(version)