diff --git a/changes/packaging.py b/changes/packaging.py index 22af7e4..3219311 100644 --- a/changes/packaging.py +++ b/changes/packaging.py @@ -9,11 +9,21 @@ log = logging.getLogger(__name__) -def install_package(context): - """Attempts to install the sdist and wheel.""" +def build_package(context): + """Builds package distributions""" build_package_command = 'python setup.py clean sdist bdist_wheel' result = shell.dry_run(build_package_command, context.dry_run) - if not context.dry_run and result: + packages = ', '.join(path('dist').files()) if not context.dry_run else "nothing" + + if not result: + raise Exception('Error building packages: %s' % result) + else: + log.info('Built %s' % packages) + + +def install_package(context): + """Attempts to install the sdist and wheel.""" + if not context.dry_run and build_package(context): with util.mktmpdir() as tmp_dir: venv.create_venv(tmp_dir=tmp_dir) for distribution in path('dist').files(): @@ -30,7 +40,8 @@ def install_package(context): def upload_package(context): - """Uploads your project with setup.py clean sdist bdist_wheel upload.""" + """Uploads your project packages to pypi with twine.""" + result = build_package(context) upload_args = 'python setup.py clean sdist upload' if context.pypi: