Skip to content

Commit 2413c76

Browse files
committed
Merge branch 'develop' into master
2 parents 4899065 + f6635b3 commit 2413c76

File tree

387 files changed

+1943
-1352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

387 files changed

+1943
-1352
lines changed

dev/Pipfile renamed to Pipfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ black = "*"
1212
docopt = "*"
1313
requests = "*"
1414
pygount = "*"
15+
pyyaml = "*"
1516

1617
[requires]
1718
python_version = "3.8"
@@ -20,4 +21,4 @@ python_version = "3.8"
2021
allow_prereleases = true
2122

2223
[scripts]
23-
pyrevit = "python ./pyrevit.py"
24+
pyrevit = "python ./dev/pyrevit.py"

dev/Pipfile.lock renamed to Pipfile.lock

+18-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/engines/2710/pyRevitLoader.dll

0 Bytes
Binary file not shown.

bin/engines/2710/pyRevitRunner.dll

0 Bytes
Binary file not shown.

bin/engines/273/pyRevitLoader.dll

0 Bytes
Binary file not shown.

bin/engines/273/pyRevitRunner.dll

0 Bytes
Binary file not shown.

bin/engines/277/pyRevitLoader.dll

0 Bytes
Binary file not shown.

bin/engines/277/pyRevitRunner.dll

0 Bytes
Binary file not shown.

bin/engines/278/pyRevitLoader.dll

0 Bytes
Binary file not shown.

bin/engines/278/pyRevitRunner.dll

0 Bytes
Binary file not shown.

bin/engines/279/pyRevitLoader.dll

0 Bytes
Binary file not shown.

bin/engines/279/pyRevitRunner.dll

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

bin/pyRevitLabs.Common.dll

1 KB
Binary file not shown.

bin/pyRevitLabs.CommonCLI.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.CommonWPF.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.DeffrelDB.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.Emojis.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.Json.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.Language.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.MahAppsMetro.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.NLog.dll

0 Bytes
Binary file not shown.

bin/pyRevitLabs.PyRevit.dll

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

bin/pyRevitLabs.TargetApps.Revit.dll

0 Bytes
Binary file not shown.

bin/pyrevit-autocomplete.exe

0 Bytes
Binary file not shown.

bin/pyrevit-products.json

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
[
2+
{
3+
"product": "pyRevit",
4+
"release": "4.8.2",
5+
"version": "4.8.2",
6+
"key": "{ECFE3DF3-2276-4A11-BA07-9F166AFE4693}"
7+
},
28
{
39
"product": "pyRevit",
410
"release": "4.8.1",
@@ -197,6 +203,12 @@
197203
"version": "4.6.1",
198204
"key": "{EF91A585-DC0C-43B8-B88B-4C130F430E84}"
199205
},
206+
{
207+
"product": "pyRevit CLI",
208+
"release": "4.8.2",
209+
"version": "4.8.2",
210+
"key": "{667ABAF1-CF3A-4CF6-AF75-68F5CA26BFA6}"
211+
},
200212
{
201213
"product": "pyRevit CLI",
202214
"release": "4.8.1",

bin/pyrevit-stubsbuilder.exe

0 Bytes
Binary file not shown.

bin/pyrevit-telemetryserver.exe

0 Bytes
Binary file not shown.

bin/pyrevit-toast.exe

0 Bytes
Binary file not shown.

bin/pyrevit.exe

512 Bytes
Binary file not shown.

dev/_props.py

+84-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
"""Set various metadata properties across source files"""
22
import sys
3-
from typing import Dict
3+
import os
4+
import os.path as op
5+
from typing import Dict, List
46
import re
57
import datetime
6-
import json
8+
import yaml
79

810
from scripts import configs
911
from scripts import utils
1012
from scripts import airtavolo
13+
from scripts.airtavolo import ToolLocales
1114

1215

1316
def _modify_contents(files, finder, new_value):
@@ -62,10 +65,85 @@ def set_ver(args: Dict[str, str]):
6265
sys.exit(1)
6366

6467

65-
# TODO: find a list of all bundles with their names
66-
# TODO: for each tool locale, lookup the bundle
67-
# TODO: write in yaml files only?
68+
def _find_tbundles(root_path) -> List[str]:
69+
tbfinder = re.compile(r".+\..+")
70+
scfinder = re.compile(r".*script\.py")
71+
tbundles = []
72+
for entry in os.listdir(root_path):
73+
epath = op.join(root_path, entry)
74+
if op.isdir(epath) and tbfinder.match(entry):
75+
if any(scfinder.match(x) for x in os.listdir(epath)):
76+
tbundles.append(epath)
77+
else:
78+
tbundles.extend(_find_tbundles(epath))
79+
return tbundles
80+
81+
82+
def _extract_title(bundle_dict):
83+
title_data = bundle_dict.get("title", None)
84+
if isinstance(title_data, dict):
85+
# find english name
86+
return title_data.get("en_us", None) or title_data.get("english", None)
87+
elif isinstance(title_data, str):
88+
# assume english?!
89+
return title_data
90+
91+
92+
def _find_tlocale(bundle_title: str, tool_locales) -> ToolLocales:
93+
for tlocale in tool_locales:
94+
if bundle_title == tlocale.name:
95+
return tlocale
96+
97+
98+
def _prepare_title(langs_dict):
99+
tdata = {}
100+
lcode_finder = re.compile(r".+\s*\[(.+)\]")
101+
for lang, tvalue in langs_dict.items():
102+
if lcode := lcode_finder.match(lang):
103+
tdata[lcode.groups()[0]] = tvalue
104+
return tdata
105+
106+
107+
def _update_locales(bundle_path: str, tool_locales: List[ToolLocales]):
108+
blfinder = re.compile(r"(.*bundle\.yaml)")
109+
bundlefile_match = next(
110+
(x for x in os.listdir(bundle_path) if blfinder.match(x)), None
111+
)
112+
bundle_name = op.splitext(op.basename(bundle_path))[0]
113+
# if bundle file exist, load and find the english title
114+
# search tool_locales for one with matching title
115+
# create the locale dict and update the existing
116+
if bundlefile_match:
117+
bundle_file = op.join(bundle_path, bundlefile_match)
118+
# read existing bundle
119+
with open(bundle_file, "r") as bfile:
120+
bundle_dict = yaml.load(bfile, Loader=yaml.SafeLoader)
121+
title = _extract_title(bundle_dict) or bundle_name
122+
tlocale = _find_tlocale(title, tool_locales)
123+
if tlocale:
124+
title_dict = bundle_dict.get("title", {"en_us": title})
125+
if isinstance(title_dict, str):
126+
title_dict = {"en_us": title_dict}
127+
# apply new values
128+
title_dict.update(_prepare_title(tlocale.langs))
129+
bundle_dict["title"] = title_dict
130+
# write back changes
131+
with open(bundle_file, "w") as bfile:
132+
yaml.dump(bundle_dict, bfile, allow_unicode=True)
133+
# otherwise if there is data for this bundle
134+
# create the bundle file and dump data
135+
else:
136+
bundle_file = op.join(bundle_path, "bundle.yaml")
137+
# grab name from bundle
138+
tlocale = _find_tlocale(bundle_name, tool_locales)
139+
if tlocale:
140+
bundle_dict = {"title": _prepare_title(tlocale.langs)}
141+
with open(bundle_file, "w") as bfile:
142+
yaml.dump(bundle_dict, bfile)
143+
144+
68145
def update_locales(_: Dict[str, str]):
69146
"""Update locale files across the extensions"""
70147
tool_locales = airtavolo.get_tool_locales()
71-
print(len(tool_locales))
148+
for tbundle in _find_tbundles(configs.EXTENSIONS_PATH):
149+
_update_locales(tbundle, tool_locales)

dev/_release.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,24 @@ def _sign_binaries():
103103
])
104104

105105

106+
def _ensure_clean_tree():
107+
res = utils.system(['git', 'status'])
108+
if 'nothing to commit' not in res:
109+
print('You have uncommited changes in working tree. Commit those first')
110+
sys.exit(1)
111+
112+
113+
def _commit_changes(msg):
114+
utils.system(['git', 'add', '--all'])
115+
utils.system(['git', 'commit', '-m', msg])
116+
117+
106118
def create_release(args: Dict[str, str]):
107-
"""Create pyRevit release (build, test, publish)"""
119+
"""Create pyRevit release (build all, create installers)"""
108120
utils.ensure_windows()
109121

122+
# _ensure_clean_tree()
123+
110124
# run a check on all tools
111125
if not install.check(args):
112126
_abort('At least one necessary tool is missing for release process')
@@ -118,14 +132,16 @@ def create_release(args: Dict[str, str]):
118132
args["<ver>"] = release_ver
119133
props.set_ver(args)
120134

121-
# now build all projects
122-
buildall.build_all(args)
123-
124135
# update installers and get new product versions
125136
pyrevit_pc, pyrevitcli_pc = _installer_set_version(release_ver)
126137
_update_product_data(release_ver, pyrevit_pc)
127138
_update_product_data(release_ver, pyrevitcli_pc, cli=True)
128139

140+
# _commit_changes(f"Updated version: {release_ver}")
141+
142+
# now build all projects
143+
buildall.build_all(args)
144+
129145
# sign everything
130146
_sign_binaries()
131147

dev/_telem.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _get_test_bin():
1818
bin_fname = "ts"
1919
if sys.platform == "win32":
2020
bin_fname = "ts.exe"
21-
return configs.TELEMETRYSERVERPATH + bin_fname
21+
return op.join(configs.TELEMETRYSERVERPATH, bin_fname)
2222

2323

2424
def _handle_break(signum, stack): #pylint: disable=unused-argument

dev/pyRevit/AssemblyVersion.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
using System.Runtime.InteropServices;
33
using System.Runtime.CompilerServices;
44

5-
[assembly: AssemblyVersion("4.8.1")]
6-
[assembly: AssemblyFileVersion("4.8.1")]
5+
[assembly: AssemblyVersion("4.8.2")]
6+
[assembly: AssemblyFileVersion("4.8.2")]

0 commit comments

Comments
 (0)