Skip to content

Commit 13717a5

Browse files
authored
Merge pull request #19 from openlawlibrary/ndusan/fix-try-running-module
fix: use `kwargs` to add keyword args to `try_running_module`
2 parents 90a3c05 + 7e271bc commit 13717a5

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ and this project adheres to a _modified_ form of _[Semantic Versioning][semver]_
1616

1717
### Removed
1818

19+
## [0.7.3]
20+
21+
### Added
22+
23+
### Changed
24+
25+
### Fixed
26+
27+
- Fix `try_running_module` by adding `kwargs` instead of hardcoded parameters. ([#19])
28+
29+
### Removed
30+
31+
[#19]: https://github.com/openlawlibrary/upgrade-python-package/pull/19
32+
1933
## [0.7.2]
2034

2135
### Added
@@ -155,7 +169,8 @@ and this project adheres to a _modified_ form of _[Semantic Versioning][semver]_
155169
[#5]: https://github.com/openlawlibrary/upgrade-python-package/pull/5
156170
[#6]: https://github.com/openlawlibrary/upgrade-python-package/pull/6
157171

158-
[Unreleased]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.2...HEAD
172+
[Unreleased]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.3...HEAD
173+
[0.7.3]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.2...0.7.3
159174
[0.7.2]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.1...0.7.2
160175
[0.7.1]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.7.0...0.7.1
161176
[0.7.0]: https://github.com/openlawlibrary/upgrade-python-package/compare/0.6.0...0.7.0

upgrade/scripts/upgrade_python_package.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def upgrade_and_run(
7373
module_name = package_name.replace("-", "_")
7474
try_running_module(
7575
module_name,
76+
*args,
7677
cloudsmith_url=cloudsmith_url,
7778
slack_webhook_url=slack_webhook_url,
78-
*args,
7979
)
8080
return was_updated, response_err
8181

@@ -458,7 +458,7 @@ def split_package_name_and_extra(package_install_cmd):
458458
return package_name, extra
459459

460460

461-
def try_running_module(wheel, cloudsmith_url=None, slack_webhook_url=None, *args):
461+
def try_running_module(wheel, *args, **kwargs):
462462
file_name = os.path.basename(wheel)
463463
module_name = file_name.split("-", 1)[0]
464464
# don't try running the module if it does not exists
@@ -468,7 +468,9 @@ def try_running_module(wheel, cloudsmith_url=None, slack_webhook_url=None, *args
468468
try:
469469
run_module_and_reload_uwsgi_app(module_name, *args)
470470
except Exception:
471+
slack_webhook_url = kwargs.get("slack_webhook_url")
471472
if slack_webhook_url is not None:
473+
cloudsmith_url = kwargs.get("cloudsmith_url")
472474
send_upgrade_notification(
473475
f"Failed to run module {module_name}",
474476
cloudsmith_url,

0 commit comments

Comments
 (0)