-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a141af
commit 5e41959
Showing
5 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
opencepk_lib_python_common/pypi_bumpversion_check_package/pypi_bumpversion_check/main.py
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import argparse | ||
import toml | ||
import sys | ||
|
25 changes: 25 additions & 0 deletions
25
...ython_common/pypi_bumpversion_check_package/tests-pre-commit-hook/.pre-commit-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
|
||
# ----------------------------- | ||
# PYPI bumpversion check | ||
# ----------------------------- | ||
- repo: local | ||
hooks: | ||
- id: install-pypi_bumpversion_check-requirements | ||
name: Install PYPI bumpversion check requirements | ||
entry: sh -c 'python3 -m pip install -r ./opencepk_lib_python_common/pypi_bumpversion_check_package/pypi_bumpversion_check/requirements.txt && exit 0' | ||
language: system | ||
always_run: true | ||
- repo: local | ||
hooks: | ||
- id: python-pypi-version-check | ||
name: python-pypi-version-check | ||
entry: python3 -m opencepk_lib_python_common.pypi_bumpversion_check_package.pypi_bumpversion_check | ||
language: python | ||
exclude_types: | ||
- binary | ||
args: ['./opencepk_lib_python_common/pypi_bumpversion_check_package/tests-pre-commit-hook/pyproject.test'] | ||
pass_filenames: false # Do not pass filenames to the hook (this is important to keep) |
44 changes: 44 additions & 0 deletions
44
...epk_lib_python_common/pypi_bumpversion_check_package/tests-pre-commit-hook/pyproject.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
packages = { find = { where = ["."] } } | ||
|
||
[project] | ||
name = "opencepk-lib-python-common" | ||
version = "0.0.0" | ||
description = "Python package and pre-commit-hook for finding and replacing string(s) in file(s)." | ||
readme = "README.md" | ||
license = { text = "GPLv3" } | ||
authors = [{name = "OpenCEPK Open Cloud Engineering Platform Kit", email = "opencepk@gmail.com"}] | ||
requires-python = ">=3.9" | ||
|
||
keywords = ["find", "replace", "string", "file", "pre-commit", "hook", "git", "tool", "utility", "opencepk"] | ||
classifiers = [ | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"Natural Language :: English", | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Topic :: File Formats :: JSON", | ||
"Topic :: Software Development :: Pre-processors", | ||
"Topic :: Software Development :: Version Control :: Git", | ||
"Topic :: Text Processing", | ||
"Topic :: Text Processing :: Filters", | ||
"Topic :: Text Processing :: General", | ||
"Topic :: Utilities" | ||
] | ||
|
||
[project.entry-points."console_scripts"] | ||
python-pypi-version-check = "opencepk_lib_python_common.pypi_bumpversion_check_package.pypi_bumpversion_check.main:main" | ||
find-and-replace-strings = "opencepk_lib_python_common.find_and_replace_strings_package.find_and_replace_strings.main:main" |
35 changes: 35 additions & 0 deletions
35
...ython_common/pypi_bumpversion_check_package/tests-pre-commit-hook/test-pre-commit-hook.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
TEST_DIR_FROM_ROOT="opencepk_lib_python_common/pypi_bumpversion_check_package/tests-pre-commit-hook" | ||
TEST_DIR="tests-pre-commit-hook" | ||
TEST_SCRIPT_FILENAME=$(basename -- "$0") | ||
TEST_SCRIPT_NAME="${TEST_SCRIPT_FILENAME%.*}" | ||
TEST_TARGET_FILE="README_TEST_PRE_COMMIT.md" | ||
|
||
#------------------------------- | ||
# Run the pre-commit hook test | ||
#------------------------------- | ||
echo "${TEST_SCRIPT_NAME}: Running pre-commit using ${TEST_DIR_FROM_ROOT}/.pre-commit-config.yaml" | ||
cd ../../.. | ||
pwd | ||
pre-commit run -a -c "${TEST_DIR_FROM_ROOT}/.pre-commit-config.yaml" | ||
|
||
# #------------------------------- | ||
# # Evaluate results | ||
# #------------------------------- | ||
# echo "${TEST_SCRIPT_NAME}: Running (cd ${TEST_DIR} && diff ${TEST_TARGET_FILE} ${TEST_TARGET_FILE}.expected)" | ||
# echo "${TEST_SCRIPT_NAME}: Fetching return code of diff" | ||
# diff "./${TEST_TARGET_FILE}" "${TEST_TARGET_FILE}.expected" | ||
# evaluate_diff_status=$? | ||
|
||
# #------------------------------- | ||
# # Run the pre-commit hook reset | ||
# #------------------------------- | ||
# echo "${TEST_SCRIPT_NAME}: Resetting ${TEST_DIR}/${TEST_TARGET_FILE} file to original state" | ||
# cp -pf "${TEST_TARGET_FILE}.template" "${TEST_TARGET_FILE}" | ||
|
||
# #------------------------------- | ||
# # Exit with exit code of diff evaluation | ||
# #------------------------------- | ||
# echo "${TEST_SCRIPT_NAME}: Exit code = $evaluate_diff_status" | ||
# exit $evaluate_diff_status |