-
Notifications
You must be signed in to change notification settings - Fork 41
/
package.py
96 lines (77 loc) · 2.85 KB
/
package.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"""Package definition file for houdini_toolbox."""
name = "houdini_toolbox"
@early()
def version() -> str:
"""Get the package version.
Because this project is not versioned we'll just use the short git hash as the version.
Returns:
The package version.
"""
import subprocess
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
authors = ["graham thompson"]
requires = [
"houdini",
]
build_system = "cmake"
build_requires = [
"PySide2", # So we can compile resources at build time.
]
plugin_for = ["houdini"]
variants = [
["houdini-19.5"],
["houdini-20.0"],
]
tests = {
"unit": {
"command": "coverage erase && hython -m pytest tests",
"requires": ["houdini", "pytest", "pytest_sugar", "coverage"],
},
"flake8": {
"command": "houdini_package_flake8",
"requires": ["houdini_package_runner", "houdini"],
"run_on": "explicit",
},
"black-check": {
"command": "houdini_package_black --check",
"requires": ["houdini_package_runner", "houdini"],
"run_on": "explicit",
},
"black": {
"command": "houdini_package_black",
"requires": ["houdini_package_runner", "houdini"],
"run_on": "explicit",
},
"pylint": {
"command": "houdini_package_pylint --skip-tests --rcfile pylintrc",
"requires": ["houdini_package_runner", "houdini"],
"run_on": "explicit",
},
"isort-check": {
"command": "houdini_package_isort --check --package-names=houdini_toolbox,_ht_generic_text_badge,_ht_generic_image_badge",
"requires": ["houdini_package_runner", "houdini"],
"run_on": "explicit",
},
"isort": {
"command": "houdini_package_isort --package-names=houdini_toolbox,_ht_generic_text_badge,_ht_generic_image_badge",
"requires": ["houdini_package_runner", "houdini"],
"run_on": "explicit",
},
}
def commands():
"""Run commands on package setup."""
env.PYTHONPATH.prepend("{root}/python")
# We won't want to set HOUDINI_PATH when testing as this will cause Houdini to
# load and run various things at startup and interfere with test coverage.
if "HOUDINI_TOOLBOX_TESTING" not in env:
env.HOUDINI_PATH.prepend("{root}/houdini")
def pre_test_commands():
"""Run commands before testing."""
# Set an indicator that a test is running, so we can set paths differently.
env.HOUDINI_TOOLBOX_TESTING = True
if test.name == "unit":
env.HOUDINI_DSO_PATH.prepend("{root}/houdini/dso")
env.HOUDINI_OTLSCAN_PATH.prepend("{root}/houdini/otls")
# When doing unit tests we need to set the TOOLBAR_PATH variable to point to the folder
# containing shelf files so that we can access and run tests against them.
env.TOOLBAR_PATH = f"{this.root}/houdini/toolbar"