Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Aug 23, 2020
2 parents 4899065 + f6635b3 commit 2413c76
Show file tree
Hide file tree
Showing 387 changed files with 1,943 additions and 1,352 deletions.
3 changes: 2 additions & 1 deletion dev/Pipfile → Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ black = "*"
docopt = "*"
requests = "*"
pygount = "*"
pyyaml = "*"

[requires]
python_version = "3.8"
Expand All @@ -20,4 +21,4 @@ python_version = "3.8"
allow_prereleases = true

[scripts]
pyrevit = "python ./pyrevit.py"
pyrevit = "python ./dev/pyrevit.py"
19 changes: 18 additions & 1 deletion dev/Pipfile.lock → Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified bin/engines/2710/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/2710/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/273/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/273/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/277/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/277/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/278/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/278/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/279/pyRevitLoader.dll
Binary file not shown.
Binary file modified bin/engines/279/pyRevitRunner.dll
Binary file not shown.
Binary file modified bin/engines/378/pyRevitLabs.PythonNet.dll
Binary file not shown.
Binary file modified bin/engines/385/pyRevitLabs.PythonNet.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Common.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonCLI.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.CommonWPF.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.DeffrelDB.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Emojis.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Json.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.Language.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.MahAppsMetro.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.NLog.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.PyRevit.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.AutoCAD.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Navisworks.dll
Binary file not shown.
Binary file modified bin/pyRevitLabs.TargetApps.Revit.dll
Binary file not shown.
Binary file modified bin/pyrevit-autocomplete.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions bin/pyrevit-products.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[
{
"product": "pyRevit",
"release": "4.8.2",
"version": "4.8.2",
"key": "{ECFE3DF3-2276-4A11-BA07-9F166AFE4693}"
},
{
"product": "pyRevit",
"release": "4.8.1",
Expand Down Expand Up @@ -197,6 +203,12 @@
"version": "4.6.1",
"key": "{EF91A585-DC0C-43B8-B88B-4C130F430E84}"
},
{
"product": "pyRevit CLI",
"release": "4.8.2",
"version": "4.8.2",
"key": "{667ABAF1-CF3A-4CF6-AF75-68F5CA26BFA6}"
},
{
"product": "pyRevit CLI",
"release": "4.8.1",
Expand Down
Binary file modified bin/pyrevit-stubsbuilder.exe
Binary file not shown.
Binary file modified bin/pyrevit-telemetryserver.exe
Binary file not shown.
Binary file modified bin/pyrevit-toast.exe
Binary file not shown.
Binary file modified bin/pyrevit.exe
Binary file not shown.
90 changes: 84 additions & 6 deletions dev/_props.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"""Set various metadata properties across source files"""
import sys
from typing import Dict
import os
import os.path as op
from typing import Dict, List
import re
import datetime
import json
import yaml

from scripts import configs
from scripts import utils
from scripts import airtavolo
from scripts.airtavolo import ToolLocales


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


# TODO: find a list of all bundles with their names
# TODO: for each tool locale, lookup the bundle
# TODO: write in yaml files only?
def _find_tbundles(root_path) -> List[str]:
tbfinder = re.compile(r".+\..+")
scfinder = re.compile(r".*script\.py")
tbundles = []
for entry in os.listdir(root_path):
epath = op.join(root_path, entry)
if op.isdir(epath) and tbfinder.match(entry):
if any(scfinder.match(x) for x in os.listdir(epath)):
tbundles.append(epath)
else:
tbundles.extend(_find_tbundles(epath))
return tbundles


def _extract_title(bundle_dict):
title_data = bundle_dict.get("title", None)
if isinstance(title_data, dict):
# find english name
return title_data.get("en_us", None) or title_data.get("english", None)
elif isinstance(title_data, str):
# assume english?!
return title_data


def _find_tlocale(bundle_title: str, tool_locales) -> ToolLocales:
for tlocale in tool_locales:
if bundle_title == tlocale.name:
return tlocale


def _prepare_title(langs_dict):
tdata = {}
lcode_finder = re.compile(r".+\s*\[(.+)\]")
for lang, tvalue in langs_dict.items():
if lcode := lcode_finder.match(lang):
tdata[lcode.groups()[0]] = tvalue
return tdata


def _update_locales(bundle_path: str, tool_locales: List[ToolLocales]):
blfinder = re.compile(r"(.*bundle\.yaml)")
bundlefile_match = next(
(x for x in os.listdir(bundle_path) if blfinder.match(x)), None
)
bundle_name = op.splitext(op.basename(bundle_path))[0]
# if bundle file exist, load and find the english title
# search tool_locales for one with matching title
# create the locale dict and update the existing
if bundlefile_match:
bundle_file = op.join(bundle_path, bundlefile_match)
# read existing bundle
with open(bundle_file, "r") as bfile:
bundle_dict = yaml.load(bfile, Loader=yaml.SafeLoader)
title = _extract_title(bundle_dict) or bundle_name
tlocale = _find_tlocale(title, tool_locales)
if tlocale:
title_dict = bundle_dict.get("title", {"en_us": title})
if isinstance(title_dict, str):
title_dict = {"en_us": title_dict}
# apply new values
title_dict.update(_prepare_title(tlocale.langs))
bundle_dict["title"] = title_dict
# write back changes
with open(bundle_file, "w") as bfile:
yaml.dump(bundle_dict, bfile, allow_unicode=True)
# otherwise if there is data for this bundle
# create the bundle file and dump data
else:
bundle_file = op.join(bundle_path, "bundle.yaml")
# grab name from bundle
tlocale = _find_tlocale(bundle_name, tool_locales)
if tlocale:
bundle_dict = {"title": _prepare_title(tlocale.langs)}
with open(bundle_file, "w") as bfile:
yaml.dump(bundle_dict, bfile)


def update_locales(_: Dict[str, str]):
"""Update locale files across the extensions"""
tool_locales = airtavolo.get_tool_locales()
print(len(tool_locales))
for tbundle in _find_tbundles(configs.EXTENSIONS_PATH):
_update_locales(tbundle, tool_locales)
24 changes: 20 additions & 4 deletions dev/_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,24 @@ def _sign_binaries():
])


def _ensure_clean_tree():
res = utils.system(['git', 'status'])
if 'nothing to commit' not in res:
print('You have uncommited changes in working tree. Commit those first')
sys.exit(1)


def _commit_changes(msg):
utils.system(['git', 'add', '--all'])
utils.system(['git', 'commit', '-m', msg])


def create_release(args: Dict[str, str]):
"""Create pyRevit release (build, test, publish)"""
"""Create pyRevit release (build all, create installers)"""
utils.ensure_windows()

# _ensure_clean_tree()

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

# now build all projects
buildall.build_all(args)

# update installers and get new product versions
pyrevit_pc, pyrevitcli_pc = _installer_set_version(release_ver)
_update_product_data(release_ver, pyrevit_pc)
_update_product_data(release_ver, pyrevitcli_pc, cli=True)

# _commit_changes(f"Updated version: {release_ver}")

# now build all projects
buildall.build_all(args)

# sign everything
_sign_binaries()

Expand Down
2 changes: 1 addition & 1 deletion dev/_telem.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _get_test_bin():
bin_fname = "ts"
if sys.platform == "win32":
bin_fname = "ts.exe"
return configs.TELEMETRYSERVERPATH + bin_fname
return op.join(configs.TELEMETRYSERVERPATH, bin_fname)


def _handle_break(signum, stack): #pylint: disable=unused-argument
Expand Down
4 changes: 2 additions & 2 deletions dev/pyRevit/AssemblyVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("4.8.1")]
[assembly: AssemblyFileVersion("4.8.1")]
[assembly: AssemblyVersion("4.8.2")]
[assembly: AssemblyFileVersion("4.8.2")]
Loading

0 comments on commit 2413c76

Please sign in to comment.