from pyrevit.coreutils.logger import get_logger #pylint: disable=W0703,C0302 mlogger = get_logger(__name__) #pylint: disable=C0103 GIT_LIB = 'LibGit2Sharp' if not EXEC_PARAMS.doc_mode: LIBGIT_DLL = framework.get_dll_file(GIT_LIB) mlogger.debug('Loading dll: %s', LIBGIT_DLL) try: if compat.PY3: clr.AddReference(LIBGIT_DLL) else: clr.AddReferenceToFileAndPath(LIBGIT_DLL) import LibGit2Sharp as libgit #pylint: disable=import-error except Exception as load_err: mlogger.error( 'Can not load %s module. ' 'This module is necessary for getting pyRevit version ' 'and staying updated. | %s', GIT_LIB, load_err) class PyRevitGitAuthenticationError(PyRevitException): """Git authentication error.""" pass
mlogger = logger.get_logger(__name__) ADC_NAME = "Autodesk Desktop Connector" ADC_SHORTNAME = "ADC" ADC_DRIVE_SCHEMA = '{drive_name}://' ADC_DEFAULT_INSTALL_PATH = \ r'C:\Program Files\Autodesk\Desktop Connector' ADC_API_DLL = 'Autodesk.DesktopConnector.API.dll' ADC_API_DLL_PATH = op.join(ADC_DEFAULT_INSTALL_PATH, ADC_API_DLL) API = None if op.exists(ADC_API_DLL_PATH): try: clr.AddReferenceToFileAndPath(ADC_API_DLL_PATH) import Autodesk.DesktopConnector.API as API #pylint: disable=import-error except: pass def _ensure_api(): if not API: raise PyRevitException("{} is not loaded".format(ADC_NAME)) return API def _get_all_processids(): return [x.Id for x in Process.GetProcesses()]
"""MathNet importer module. See https://www.mathdotnet.com for documentation. Example: >>> from pyrevit.coreutils.mathnet import MathNet """ #pylint: disable=W0703,C0302,C0103 from pyrevit import EXEC_PARAMS from pyrevit import framework from pyrevit.framework import clr from pyrevit.coreutils.logger import get_logger mlogger = get_logger(__name__) MATHNET_LIB = 'MathNet.Numerics' if not EXEC_PARAMS.doc_mode: mathnet_dll = framework.get_dll_file(MATHNET_LIB) mlogger.debug('Loading dll: %s', mathnet_dll) try: clr.AddReferenceToFileAndPath(mathnet_dll) import MathNet #pylint: disable=E0401,W0611 except Exception as load_err: mlogger.error('Can not load %s module. | %s', MATHNET_LIB, load_err)
from pyrevit.compat import safe_strtype from pyrevit.framework import clr from pyrevit.framework import DateTime, DateTimeOffset from pyrevit.coreutils.logger import get_logger from pyrevit.loader.addin import get_addin_dll_file logger = get_logger(__name__) GIT_LIB = 'LibGit2Sharp' if not EXEC_PARAMS.doc_mode: libgit_dll = get_addin_dll_file(GIT_LIB) logger.debug('Loading dll: {}'.format(libgit_dll)) try: clr.AddReferenceToFileAndPath(libgit_dll) # public libgit module libgit = importlib.import_module(GIT_LIB) except Exception as load_err: logger.error('Can not load {} module. ' 'This module is necessary for getting pyRevit version ' 'and staying updated. | {}'.format(GIT_LIB, load_err)) class PyRevitGitAuthenticationError(PyRevitException): pass class RepoInfo: """ Generic repo wrapper for passing repository information to other modules
clr.AddReference('MadMilkman.Ini') clr.AddReference('OpenMcdf') clr.AddReference('YamlDotNet') clr.AddReference('pyRevitLabs.NLog') clr.AddReference('pyRevitLabs.MahAppsMetro') # roslyn csharp compiler dependencies are referenced by # pyRevitLabs.Common thus loading ahead clr.AddReference('System.Threading.Tasks.Extensions') clr.AddReference('System.Collections.Immutable') clr.AddReference('System.Numerics.Vectors') clr.AddReference('System.Text.Encoding.CodePages') # Revit, and its builtin addons, ship multiple versions of this assembly # let's make sure our specific version is loaded if compat.PY2: clr.AddReferenceToFileAndPath( op.join(BIN_DIR, 'System.Runtime.CompilerServices.Unsafe.dll') ) clr.AddReferenceToFileAndPath( op.join(BIN_DIR, 'System.Memory.dll') ) else: clr.AddReference('System.Runtime.CompilerServices.Unsafe') clr.AddReference('System.Memory.dll') # clr.AddReference('System.Memory') clr.AddReference('System.Reflection.Metadata') clr.AddReference('Microsoft.CodeAnalysis') clr.AddReference('Microsoft.CodeAnalysis.CSharp') # and now clr.AddReference('pyRevitLabs.Common') clr.AddReference('pyRevitLabs.CommonCLI') clr.AddReference('pyRevitLabs.CommonWPF')