Skip to content

Commit

Permalink
Extract build_package step
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljoseph committed Oct 12, 2014
1 parent 8bc57ff commit 04e1f3f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions changes/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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:
Expand Down

0 comments on commit 04e1f3f

Please sign in to comment.