Skip to content

Commit 738cac0

Browse files
committed
Merge branch 'develop'
# Conflicts: # bin/pyrevit-hosts.json
2 parents 4319ff0 + cc70530 commit 738cac0

File tree

89 files changed

+1224
-234
lines changed

Some content is hidden

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

89 files changed

+1224
-234
lines changed

README.md

+133-1

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

0 Bytes
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

512 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

-61.5 KB
Binary file not shown.

bin/pyrevit-hosts.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@
13491349
"source": "https://help.autodesk.com/view/RVT/2021/ENU/?guid=RevitReleaseNotes_2021updates_2021_1_1_html"
13501350
},
13511351
"product": "Autodesk Revit",
1352-
"release": "2020.1.1",
1352+
"release": "2021.1.1",
13531353
"version": "21.1.10.26",
13541354
"build": "20200909_1515",
13551355
"target": "x64",

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.3",
5+
"version": "4.8.3",
6+
"key": "{696310B4-5E37-4437-B047-20954E4B2814}"
7+
},
28
{
39
"product": "pyRevit",
410
"release": "4.8.2",
@@ -203,6 +209,12 @@
203209
"version": "4.6.1",
204210
"key": "{EF91A585-DC0C-43B8-B88B-4C130F430E84}"
205211
},
212+
{
213+
"product": "pyRevit CLI",
214+
"release": "4.8.3",
215+
"version": "4.8.3",
216+
"key": "{F0958CD1-EEF8-481D-871C-7501947EC650}"
217+
},
206218
{
207219
"product": "pyRevit CLI",
208220
"release": "4.8.2",

bin/pyrevit-stubsbuilder.exe

0 Bytes
Binary file not shown.

bin/pyrevit-telemetryserver.exe

-768 KB
Binary file not shown.

bin/pyrevit-toast.exe

0 Bytes
Binary file not shown.

bin/pyrevit.exe

0 Bytes
Binary file not shown.

dev/_changelog.py

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def title(self):
101101
ChangeGroup(tag="runtime", header="Runtime"),
102102
ChangeGroup(tag="framework", header="Framework Updates"),
103103
ChangeGroup(tag="installer", header="Installer"),
104+
ChangeGroup(tag="cli", header="Command Line Utility"),
104105
ChangeGroup(tag="bundles", header="Script bundles"),
105106
ChangeGroup(tag="tele", header="Telemetry"),
106107
ChangeGroup(tag="api", header="API"),

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.2")]
6-
[assembly: AssemblyFileVersion("4.8.2")]
5+
[assembly: AssemblyVersion("4.8.3")]
6+
[assembly: AssemblyFileVersion("4.8.3")]

dev/pyRevitLabs/pyRevitCLI/PyRevitCLI.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ private static void ProcessArguments() {
278278
else if (all("update"))
279279
PyRevitCLICloneCmds.UpdateClone(
280280
allClones: arguments["--all"].IsTrue,
281-
cloneName: TryGetValue("<clone_name>")
281+
cloneName: TryGetValue("<clone_name>"),
282+
username: TryGetValue("--username"),
283+
password: TryGetValue("--password")
282284
);
283285

284286
else
@@ -432,7 +434,9 @@ private static void ProcessArguments() {
432434
else if (all("update"))
433435
PyRevitCLIExtensionCmds.UpdateExtension(
434436
all: arguments["--all"].IsTrue,
435-
extName: TryGetValue("<extension_name>")
437+
extName: TryGetValue("<extension_name>"),
438+
username: TryGetValue("--username"),
439+
password: TryGetValue("--password")
436440
);
437441

438442
else if (IsHelpMode)

dev/pyRevitLabs/pyRevitCLI/PyRevitCLICloneCmds.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ internal static void
229229
}
230230

231231
internal static void
232-
UpdateClone(bool allClones, string cloneName) {
232+
UpdateClone(bool allClones, string cloneName, string username, string password) {
233233
// TODO: ask for closing running Revits
234234

235235
// prepare a list of clones to be updated
@@ -260,7 +260,7 @@ internal static void
260260
// update clones that do not include this process
261261
foreach (var clone in targetClones) {
262262
logger.Debug("Updating clone \"{0}\"", clone.Name);
263-
PyRevitClones.Update(clone);
263+
PyRevitClones.Update(clone, username, password);
264264
}
265265

266266
// now update myClone if any, as last step

dev/pyRevitLabs/pyRevitCLI/PyRevitCLIExtensionCmds.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ internal static void
209209
}
210210

211211
internal static void
212-
UpdateExtension(bool all, string extName) {
212+
UpdateExtension(bool all, string extName, string username, string password) {
213213
if (all)
214-
PyRevitExtensions.UpdateAllInstalledExtensions();
214+
PyRevitExtensions.UpdateAllInstalledExtensions(username, password);
215215
else if (extName != null)
216-
PyRevitExtensions.UpdateExtension(extName);
216+
PyRevitExtensions.UpdateExtension(extName, username, password);
217217
}
218218
}
219219
}

dev/pyRevitLabs/pyRevitCLI/Resources/UsagePatterns.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Usage:
2020
pyrevit clones commit <clone_name> [<commit_hash>] [--log=<log_file>]
2121
pyrevit clones origin <clone_name> --reset [--log=<log_file>]
2222
pyrevit clones origin <clone_name> [<origin_url>] [--log=<log_file>]
23-
pyrevit clones update (--all | <clone_name>) [--log=<log_file>]
23+
pyrevit clones update (--all | <clone_name>) [--log=<log_file>] [--username=<username>] [--password=<password>]
2424
pyrevit clones deployments <clone_name>
2525
pyrevit clones engines <clone_name>
2626
pyrevit attach --help
@@ -49,7 +49,7 @@ Usage:
4949
pyrevit extensions sources [--help]
5050
pyrevit extensions sources forget --all [--log=<log_file>]
5151
pyrevit extensions sources (add | forget) <source_json_or_url> [--log=<log_file>]
52-
pyrevit extensions update (--all | <extension_name>) [--log=<log_file>]
52+
pyrevit extensions update (--all | <extension_name>) [--log=<log_file>] [--username=<username>] [--password=<password>]
5353
pyrevit releases --help
5454
pyrevit releases [--pre] [--notes]
5555
pyrevit releases latest [--pre] [--notes]

dev/pyRevitLabs/pyRevitLabs.Common/GitInstaller.cs

+15-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Linq;
44
using System.Text;
55
using System.Threading.Tasks;
6-
6+
using System.Web.UI.WebControls.Adapters;
77
using LibGit2Sharp;
88
using pyRevitLabs.NLog;
99

@@ -106,12 +106,19 @@ public static void CheckoutBranch(string repoPath, string branchName) {
106106

107107
// rebase current branch and pull from master
108108
// @handled @logs
109-
public static UpdateStatus ForcedUpdate(string repoPath) {
109+
public static UpdateStatus ForcedUpdate(string repoPath, string username, string password) {
110110
logger.Debug("Force updating repo \"{0}\"...", repoPath);
111111
try {
112112
var repo = new Repository(repoPath);
113113
var options = new PullOptions();
114-
options.FetchOptions = new FetchOptions();
114+
var fetchOpts = new FetchOptions();
115+
116+
// add username and password to clone options, if provided by user
117+
if (username != null && password != null)
118+
fetchOpts.CredentialsProvider =
119+
(_url, _usernameFromUrl, _credTypes) => new UsernamePasswordCredentials { Username = username, Password = password };
120+
121+
options.FetchOptions = fetchOpts;
115122

116123
// before updating, let's first
117124
// forced checkout to overwrite possible local changes
@@ -233,10 +240,12 @@ public static string GetCheckedoutBranch(string repoPath) {
233240
// get the checkedout branch from repopath
234241
// @handled @logs
235242
public static string GetHeadCommit(string repoPath) {
243+
string head = null;
236244
if (IsValidRepo(repoPath))
237-
return new Repository(repoPath).Head.Tip.Id.ToString();
238-
logger.Debug("Can not determine head commit hash for \"{0}\"", repoPath);
239-
return null;
245+
head = new Repository(repoPath).Head?.Tip?.Id.ToString();
246+
if (head is null)
247+
logger.Debug("Can not determine head commit hash for \"{0}\"", repoPath);
248+
return head;
240249
}
241250

242251
// get the checkedout branch from repopath

dev/pyRevitLabs/pyRevitLabs.Common/UserEnv.cs

+10-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ public static Version GetInstalledDotNetVersion() {
5252

5353
public static List<string> GetInstalledDotnetTargetPacks() {
5454
var targetPackPaths = new List<string>();
55-
var frameworkPath = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework";
55+
var frameworkPath = Path.Combine(
56+
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
57+
@"Reference Assemblies\Microsoft\Framework\.NETFramework"
58+
);
5659
foreach (string path in Directory.GetDirectories(frameworkPath))
5760
if (Regex.Match(Path.GetFileName(path), @"\d\..+").Success)
5861
targetPackPaths.Add(path);
@@ -61,7 +64,10 @@ public static List<string> GetInstalledDotnetTargetPacks() {
6164

6265
public static List<string> GetInstalledDotnetCoreTargetPacks() {
6366
var targetPackPaths = new List<string>();
64-
var frameworkPath = @"C:\Program Files\dotnet\sdk";
67+
var frameworkPath = Path.Combine(
68+
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
69+
@"dotnet\sdk"
70+
);
6571
foreach (string path in Directory.GetDirectories(frameworkPath))
6672
if (Regex.Match(Path.GetFileName(path), @"\d\..+").Success)
6773
targetPackPaths.Add(path);
@@ -80,7 +86,8 @@ public static string GetLoggedInUserName() {
8086
foreach (ManagementObject oReturn in oReturnCollection) {
8187
return oReturn["UserName"].ToString();
8288
}
83-
} catch (Exception ex) {
89+
}
90+
catch (Exception ex) {
8491
logger.Debug("Failed to get logged in username. | {0}", ex.Message);
8592
}
8693
return null;

dev/pyRevitLabs/pyRevitLabs.PyRevit/PyRevitAttachments.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,17 @@ public static List<PyRevitAttachment> GetAttachments() {
124124

125125
// get all attachments for a revit version
126126
// @handled @logs
127-
public static List<PyRevitAttachment> GetAllAttached(int revitYear) =>
128-
GetAttachments().Where(x => x.Product.ProductYear == revitYear).OrderBy(x => x.AllUsers).ToList();
127+
public static List<PyRevitAttachment> GetAllAttached(int revitYear) {
128+
var attachments = GetAttachments().Where(x => x.Product.ProductYear == revitYear);
129+
if (attachments.Count() > 0)
130+
return attachments.OrderBy(x => x.AllUsers).ToList();
131+
return new List<PyRevitAttachment>();
132+
}
129133

130134
// get attachment for a revit version
131135
// @handled @logs
132136
public static PyRevitAttachment GetAttached(int revitYear) {
133-
return GetAllAttached(revitYear)?.First();
137+
return GetAllAttached(revitYear)?.FirstOrDefault();
134138
}
135139

136140
}

0 commit comments

Comments
 (0)