Skip to content

Commit

Permalink
fix poetry build not including version_sets/0.5 files (#97)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Kwan <[email protected]>
  • Loading branch information
joshk0 authored Nov 11, 2023
1 parent 6b58290 commit a91b70e
Show file tree
Hide file tree
Showing 64 changed files with 93 additions and 74 deletions.
21 changes: 21 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import pathlib
import shutil
import yaml

def copy_rules(basedir):
with open(os.path.join(basedir, 'version_sets.yaml'), 'r') as file:
version_sets = yaml.safe_load(file)

for version, base_files in version_sets.items():
dest = os.path.join(basedir, 'version_sets', version)
if os.path.exists(dest):
shutil.rmtree(dest)
pathlib.Path(dest).mkdir(parents=True)
for f in base_files:
src_file = os.path.join(basedir, 'base_rule_definitions', f)
dest_file = os.path.join(dest, f)
shutil.copyfile(src_file, dest_file)

if __name__ == "__main__":
copy_rules(basedir='focus_validator/rules')
2 changes: 2 additions & 0 deletions focus_validator/rules/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by build.py at wheel-time
version_sets/
60 changes: 60 additions & 0 deletions focus_validator/rules/version_sets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'0.5':
- FV-D001-0001.yaml
- FV-D001-0002.yaml
- FV-D001-0003.yaml
- FV-D001-0004.yaml
- FV-D002-0001.yaml
- FV-D002-0002.yaml
- FV-D003-0001.yaml
- FV-D003-0002.yaml
- FV-D004-0001.yaml
- FV-D004-0002.yaml
- FV-D004-0003.yaml
- FV-D005-0001.yaml
- FV-D005-0002.yaml
- FV-D005-0003.yaml
- FV-D006-0001.yaml
- FV-D006-0002.yaml
- FV-D006-0003.yaml
- FV-D007-0001.yaml
- FV-D007-0002.yaml
- FV-D007-0003.yaml
- FV-D008-0001.yaml
- FV-D008-0002.yaml
- FV-D008-0003.yaml
- FV-D009-0001.yaml
- FV-D009-0002.yaml
- FV-D009-0003.yaml
- FV-D010-0001.yaml
- FV-D010-0002.yaml
- FV-D010-0003.yaml
- FV-D011-0001.yaml
- FV-D011-0002.yaml
- FV-D011-0003.yaml
- FV-D012-0001.yaml
- FV-D012-0002.yaml
- FV-D012-0003.yaml
- FV-D013-0001.yaml
- FV-D013-0002.yaml
- FV-D013-0003.yaml
- FV-D014-0001.yaml
- FV-D014-0002.yaml
- FV-D015-0001.yaml
- FV-D015-0002.yaml
- FV-D015-0003.yaml
- FV-D015-0004.yaml
- FV-D016-0001.yaml
- FV-D016-0002.yaml
- FV-D016-0003.yaml
- FV-D017-0001.yaml
- FV-D017-0002.yaml
- FV-D017-0003.yaml
- FV-D018-0001.yaml
- FV-D018-0002.yaml
- FV-D018-0003.yaml
- FV-M001-0001.yaml
- FV-M001-0002.yaml
- FV-M001-0003.yaml
- FV-M002-0001.yaml
- FV-M002-0002.yaml
- FV-M002-0003.yaml
1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D001-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D001-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D001-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D001-0004.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D002-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D002-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D003-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D003-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D004-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D004-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D004-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D005-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D005-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D005-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D006-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D006-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D006-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D007-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D007-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D007-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D008-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D008-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D008-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D009-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D009-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D009-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D010-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D010-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D010-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D011-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D011-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D011-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D012-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D012-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D012-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D013-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D013-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D013-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D014-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D014-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D015-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D015-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D015-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D015-0004.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D016-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D016-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D016-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D017-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D017-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D017-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D018-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D018-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-D018-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-M001-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-M001-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-M001-0003.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-M002-0001.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-M002-0002.yaml

This file was deleted.

1 change: 0 additions & 1 deletion focus_validator/rules/version_sets/0.5/FV-M002-0003.yaml

This file was deleted.

12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ authors = []
readme = "README.md"
packages = [{ include = "focus_validator" }]
include = [
{ path = "focus_validator/rules/version_sets/0.5/*", format = ["sdist", "wheel"] }
{ path = "focus_validator/rules/version_sets/0.5/*" }
]
# TODO: For some reason, this doesn't exclude anything
exclude = [
{ path = "focus_validator/rules/base_rule_definitions/*" }
]

[tool.poetry.build]
generate-setup-file = false
script = "build.py"

[tool.poetry.dependencies]
python = "^3.8.3"
Expand Down Expand Up @@ -45,7 +53,7 @@ pre-commit = "^3.3.3"
bump2version = "^1.0.1"

[build-system]
requires = ["poetry-core"]
requires = ["poetry-core", "pyyaml"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
Expand Down
13 changes: 0 additions & 13 deletions tests/test_match_check_id_rule_config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,3 @@ def test_match_check_id_in_base_definitions(self):
rule = Rule.load_yaml(rule_path=rule_path)
self.assertIsInstance(rule, Rule)
self.assertEqual(rule.check_id, Path(name).stem)

def test_version_sets(self):
for root, dirs, files in os.walk(
"focus_validator/rules/version_sets", topdown=False
):
for name in files:
rule_path = os.path.join(root, name)
self.assertTrue(
os.path.islink(rule_path), f"path not a sym link, {rule_path}"
)
self.assertTrue(
Path(rule_path).exists(), f"invalid sym link, {rule_path}"
)

0 comments on commit a91b70e

Please sign in to comment.