Skip to content

Commit 7ea8800

Browse files
committed
adjust changelog; few missing Pathlib bits
1 parent e6820e3 commit 7ea8800

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Bugfixes:
1919
* DPF: also send BPM value to `__hv_dpf_bpm` when transport is not playing
2020
* Wwise: use latest Windows SDK available locally instead of hardcoded version
2121

22+
Refactor:
23+
24+
* Migrate to Pathlib
25+
2226
0.15.0
2327
-----
2428

hvcc/generators/c2fmod/c2fmod.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ def compile(
7272
for f in env.list_templates(extensions=src_ext_list):
7373
file = Path(f)
7474
file_dir = Path(out_dir, file.parent)
75-
file_name = f
7675

77-
file_name = file_name.replace("{{name}}", patch_name)
76+
file_name = file.name.replace("{{name}}", patch_name)
7877
file_path = Path(file_dir, file_name)
7978

8079
if not file_path.parent.exists():

hvcc/generators/c2js/c2js.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def compile(
223223
# delete temporary files
224224
os.remove(post_js_path)
225225

226-
js_out_file = js_path
226+
js_out_file = js_path.name
227227

228228
# generate index.html from template
229229
with open(Path(out_dir, "index.html"), "w") as f:

hvcc/generators/c2wwise/c2wwise.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
import os
1817
import shutil
1918
import time
2019
import jinja2
@@ -66,7 +65,7 @@ def compile(
6665

6766
out_dir = Path(out_dir, "wwise")
6867
if not out_dir.exists():
69-
os.makedirs(out_dir)
68+
out_dir.mkdir()
7069

7170
env = jinja2.Environment()
7271
env.loader = jinja2.FileSystemLoader(
@@ -104,15 +103,15 @@ def compile(
104103

105104
src_ext_list = ["h", "hpp", "c", "cpp", "xml", "def", "rc", "lua", "json"]
106105
for f in env.list_templates(extensions=src_ext_list):
107-
file_dir = Path(out_dir, os.path.dirname(f))
108-
file_name = os.path.basename(f)
106+
file = Path(f)
107+
file_dir = Path(out_dir, file.parent)
109108

110-
file_name = file_name.replace("{{name}}", patch_name)
109+
file_name = file.name.replace("{{name}}", patch_name)
111110
file_name = file_name.replace("{{plugin_type}}", plugin_type)
112111
file_path = Path(file_dir, file_name)
113112

114113
if not file_path.parent.exists():
115-
os.makedirs(file_path.parent)
114+
file_path.parent.mkdir(parents=True)
116115

117116
with open(file_path, "w") as g:
118117
g.write(env.get_template(f).render(

hvcc/interpreters/pd2hv/PdGraph.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(
3737
super().__init__("graph", obj_args, pos_x, pos_y)
3838

3939
# file location of this graph
40-
self.__pd_path = pd_path
40+
self.__pd_path: Path = pd_path
4141

4242
self.__objs: List[PdObject] = []
4343
self.__connections: List[Connection] = []
@@ -57,7 +57,7 @@ def __init__(
5757

5858
# TODO(dromer) these are virtual attributes that are only instantiated with internal representation
5959
self._PdGraph__connections: List[Connection] = []
60-
self._PdGraph__pd_path: str = ""
60+
self._PdGraph__pd_path: Path = Path()
6161

6262
@property
6363
def dollar_zero(self) -> str:
@@ -238,4 +238,4 @@ def to_hv(self, export_args: bool = False) -> Dict:
238238
}
239239

240240
def __repr__(self) -> str:
241-
return self.subpatch_name or str(self.__pd_path)
241+
return self.subpatch_name or self.__pd_path.name

hvcc/interpreters/pd2hv/PdLibSignalGraph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
import os
1817
from typing import List
1918
from pathlib import Path
2019

@@ -84,5 +83,5 @@ def validate_configuration(self) -> None:
8483

8584
def __repr__(self) -> str:
8685
return "[{0} {1}]".format(
87-
os.path.splitext(os.path.basename(self._PdGraph__pd_path))[0],
86+
self._PdGraph__pd_path.stem,
8887
" ".join(self.obj_args[1:]))

0 commit comments

Comments
 (0)