diff options
author | wbond <will@wbond.net> | 2018-04-20 11:02:59 -0400 |
---|---|---|
committer | wbond <will@wbond.net> | 2018-04-20 11:02:59 -0400 |
commit | 31b6675f14c6d9f6f1e3ea0dc6e03a2a87606a6b (patch) | |
tree | 7f0f132ceecd84bf94b63d90d23336c3ebb627ec /dev | |
parent | d3f9af047318322fbe205185ff0fd605f3118aed (diff) | |
download | asn1crypto-31b6675f14c6d9f6f1e3ea0dc6e03a2a87606a6b.tar.gz |
Fix dev files copied from oscrypto
Diffstat (limited to 'dev')
-rw-r--r-- | dev/__init__.py | 19 | ||||
-rw-r--r-- | dev/ci.py | 5 | ||||
-rw-r--r-- | dev/coverage.py | 15 | ||||
-rw-r--r-- | dev/deps.py | 15 | ||||
-rw-r--r-- | dev/lint.py | 10 | ||||
-rw-r--r-- | dev/modularcrypto.json | 8 | ||||
-rw-r--r-- | dev/release.py | 12 |
7 files changed, 44 insertions, 40 deletions
diff --git a/dev/__init__.py b/dev/__init__.py index e69de29..e85979e 100644 --- a/dev/__init__.py +++ b/dev/__init__.py @@ -0,0 +1,19 @@ +# coding: utf-8 +from __future__ import unicode_literals, division, absolute_import, print_function + +import os + + +package_name = "asn1crypto" + +other_packages = [ + "oscrypto", + "certbuilder", + "certvalidator", + "crlbuilder", + "csrbuilder", + "ocspbuilder" +] + +package_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +build_root = os.path.abspath(os.path.join(package_root, '..')) @@ -5,8 +5,9 @@ import sys import os import imp -package_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -build_root = os.path.abspath(os.path.join(package_root, '..')) +from . import build_root + + deps_dir = os.path.join(build_root, 'modularcrypto-deps') if os.path.exists(deps_dir): sys.path.insert(1, deps_dir) diff --git a/dev/coverage.py b/dev/coverage.py index 8e55e9f..4b39e65 100644 --- a/dev/coverage.py +++ b/dev/coverage.py @@ -11,6 +11,8 @@ import platform as _plat import subprocess from fnmatch import fnmatch +from . import package_name, package_root, other_packages + if sys.version_info < (3,): str_cls = unicode # noqa from urllib2 import Request, urlopen, HTTPError @@ -36,14 +38,11 @@ def run(ci=False): A bool - if the tests ran successfully """ - with open(os.path.join(os.path.dirname(__file__), 'modularcrypto.json'), 'rb') as f: - modularcrypto_packages = json.loads(f.read().decode('utf-8')) - - xml_report_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'coverage.xml')) + xml_report_path = os.path.join(package_root, 'coverage.xml') if os.path.exists(xml_report_path): os.unlink(xml_report_path) - cov = coverage.Coverage(include='oscrypto/*.py') + cov = coverage.Coverage(include='%s/*.py' % package_name) cov.start() from .tests import run as run_tests @@ -53,8 +52,8 @@ def run(ci=False): if ci: suite = unittest.TestSuite() loader = unittest.TestLoader() - for package_name in modularcrypto_packages: - for test_class in _load_package_tests(package_name): + for other_package in other_packages: + for test_class in _load_package_tests(other_package): suite.addTest(loader.loadTestsFromTestCase(test_class)) if suite.countTestCases() > 0: @@ -159,7 +158,7 @@ def _codecov_submit(): else: root = os.getcwd() else: - root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + root = package_root if not os.path.exists(os.path.join(root, '.git')): print('git repository not found, not submitting coverage data') return diff --git a/dev/deps.py b/dev/deps.py index d9d2330..91a034a 100644 --- a/dev/deps.py +++ b/dev/deps.py @@ -10,6 +10,7 @@ import json import tarfile import zipfile +from . import package_root, build_root, other_packages from ._pep425 import _pep425tags, _pep425_implementation if sys.version_info < (3,): @@ -24,27 +25,21 @@ def run(): modularcrypto repos for more accurate coverage data. """ - package_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) - build_root = os.path.abspath(os.path.join(package_root, '..')) - deps_dir = os.path.join(build_root, 'modularcrypto-deps') if os.path.exists(deps_dir): shutil.rmtree(deps_dir, ignore_errors=True) os.mkdir(deps_dir) - with open(os.path.join(os.path.dirname(__file__), 'modularcrypto.json'), 'rb') as f: - modularcrypto_packages = json.loads(f.read().decode('utf-8')) - try: print("Staging ci dependencies") _stage_requirements(deps_dir, os.path.join(package_root, 'requires', 'ci')) print("Checking out modularcrypto packages for coverage") - for pkg_name in modularcrypto_packages: - pkg_url = 'https://github.com/wbond/%s.git' % pkg_name - pkg_dir = os.path.join(build_root, pkg_name) + for other_package in other_packages: + pkg_url = 'https://github.com/wbond/%s.git' % other_package + pkg_dir = os.path.join(build_root, other_package) if os.path.exists(pkg_dir): - print("%s is already present" % pkg_name) + print("%s is already present" % other_package) continue print("Cloning %s" % pkg_url) _execute(['git', 'clone', pkg_url], build_root) diff --git a/dev/lint.py b/dev/lint.py index 321b74f..c0f3441 100644 --- a/dev/lint.py +++ b/dev/lint.py @@ -3,6 +3,8 @@ from __future__ import unicode_literals, division, absolute_import, print_functi import os +from . import package_name, package_root + import flake8 if not hasattr(flake8, '__version_info__') or flake8.__version_info__ < (3,): from flake8.engine import get_style_guide @@ -10,10 +12,6 @@ else: from flake8.api.legacy import get_style_guide -cur_dir = os.path.dirname(__file__) -config_file = os.path.join(cur_dir, '..', 'tox.ini') - - def run(): """ Runs flake8 lint @@ -24,10 +22,10 @@ def run(): print('Running flake8') - flake8_style = get_style_guide(config_file=config_file) + flake8_style = get_style_guide(config_file=os.path.join(package_root, 'tox.ini')) paths = [] - for _dir in ['asn1crypto', 'dev', 'tests']: + for _dir in [package_name, 'dev', 'tests']: for root, _, filenames in os.walk(_dir): for filename in filenames: if not filename.endswith('.py'): diff --git a/dev/modularcrypto.json b/dev/modularcrypto.json deleted file mode 100644 index f60002c..0000000 --- a/dev/modularcrypto.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "oscrypto", - "certbuilder", - "certvalidator", - "crlbuilder", - "csrbuilder", - "ocspbuilder" -]
\ No newline at end of file diff --git a/dev/release.py b/dev/release.py index 316d75c..d5a3c7e 100644 --- a/dev/release.py +++ b/dev/release.py @@ -8,9 +8,7 @@ import sys import setuptools.sandbox import twine.cli - -base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -setup_file = os.path.join(base_dir, 'setup.py') +from . import package_name, package_root def run(): @@ -22,11 +20,13 @@ def run(): A bool - if the packaging and upload process was successful """ + setup_file = os.path.join(package_root, 'setup.py') + git_wc_proc = subprocess.Popen( ['git', 'status', '--porcelain', '-uno'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - cwd=base_dir + cwd=package_root ) git_wc_status, _ = git_wc_proc.communicate() @@ -39,7 +39,7 @@ def run(): ['git', 'tag', '-l', '--contains', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, - cwd=base_dir + cwd=package_root ) tag, tag_error = git_tag_proc.communicate() @@ -59,7 +59,7 @@ def run(): ['sdist', 'bdist_wheel', '--universal'] ) - twine.cli.dispatch(['upload', 'dist/asn1crypto-%s*' % tag]) + twine.cli.dispatch(['upload', 'dist/%s-%s*' % (package_name, tag)]) setuptools.sandbox.run_setup( setup_file, |