Skip to content

Commit

Permalink
feat(build): allow config setting for build command (#195)
Browse files Browse the repository at this point in the history
* feat(build): allow config setting for build command

BREAKING CHANGE: Previously the build_commands configuration variable set the types of bundles sent to `python setup.py`. It has been replaced by the configuration variable `build_command` which takes the full command e.g. `python setup.py sdist` or `poetry build`.

Closes #188
  • Loading branch information
alandtse committed Mar 22, 2020
1 parent c878cd3 commit 740f4bd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/configuration.rst
Expand Up @@ -44,11 +44,11 @@ Moreover, those configuration values can be overloaded with the ``-D`` option, l
GitHub, this will be skipped regardless.

``commit_subject``
Git commit subject line. Accepts the following variables as format fields: [``{version}``].
Git commit subject line. Accepts the following variables as format fields: [``{version}``].
Default: ``{version}``

``commit_message``
Git commit message body. Accepts the following variables as format fields: [``{version}``].
Git commit message body. Accepts the following variables as format fields: [``{version}``].
Default: ``Automatically generated by python-semantic-release``

``commit_author``
Expand All @@ -61,8 +61,8 @@ Moreover, those configuration values can be overloaded with the ``-D`` option, l
``remove_dist``
Flag for whether the dist folder should be removed after a release. Default: true

``build_commands``
Parameters to call setup.py with to build dists. Default: ``sdist bdist_wheel``
``build_command``
Command to build dists. Build output should be stored in the directory configured in ``dist_path``. Default: ``python setup.py sdist bdist_wheel``

``branch``
The branch to run releases from. Default: master
Expand Down
2 changes: 1 addition & 1 deletion semantic_release/defaults.cfg
Expand Up @@ -12,5 +12,5 @@ commit_subject={version}
commit_message=Automatically generated by python-semantic-release
dist_path=dist
remove_dist=true
build_commands=sdist bdist_wheel
build_commands=python setup.py sdist bdist_wheel
branch=master
4 changes: 2 additions & 2 deletions semantic_release/dist.py
Expand Up @@ -6,8 +6,8 @@


def build_dists():
commands = config.get('semantic_release', 'build_commands')
run(f'python setup.py {commands}')
command = config.get('semantic_release', 'build_command')
run(command)


def remove_dists(path: str):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dist.py
Expand Up @@ -13,4 +13,4 @@ def test_build_command(mocker, commands):
mocker.patch('semantic_release.dist.config.get', lambda *a: commands)
mock_run = mocker.patch('semantic_release.dist.run')
build_dists()
mock_run.assert_called_once_with('python setup.py ' + commands)
mock_run.assert_called_once_with(commands)

0 comments on commit 740f4bd

Please sign in to comment.