Skip to content Navigation Menu Toggle navigation Sign in Appearance settings PlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub Copilot appDirect agents from issue to mergeMCP RegistryNewIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersView all resourcesOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityAcceleratorGitHub StarsArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricing Search or jump to... Search code, repositories, users, issues, pull requests... Search Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Saved searches Use saved searches to filter your results more quickly Name Query To see all available qualifiers, see our documentation. Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} autodesk-forks / pythonnet Public forked from pythonnet/pythonnet Notifications You must be signed in to change notification settings Fork 2 Star 2 Code Issues 0 Pull requests 1 Discussions Actions Models Security and quality 0 Insights Additional navigation options Code Issues Pull requests Discussions Actions Models Security and quality Insights FilesExpand file tree pythonnet3Breadcrumbspythonnet/setup.pyCopy pathBlameMore file actionsBlameMore file actions Latest commit HistoryHistoryHistory138 lines (107 loc) · 3.78 KB pythonnet3Breadcrumbspythonnet/setup.pyCopy pathTopFile metadata and controlsCodeBlame138 lines (107 loc) · 3.78 KBRawCopy raw fileDownload raw fileOpen symbols panelEdit and raw actions123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138#!/usr/bin/env python import distutilsfrom distutils.command.build import build as _buildfrom setuptools.command.develop import develop as _developfrom wheel.bdist_wheel import bdist_wheel as _bdist_wheelfrom setuptools import Distributionfrom setuptools import setup, Command import os # Disable SourceLink during the build until it can read repo-format v1, #1613os.environ["EnableSourceControlManagerQueries"] = "false" class DotnetLib: def __init__(self, name, path, **kwargs): self.name = name self.path = path self.args = kwargs class build_dotnet(Command): """Build command for dotnet-cli based builds""" description = "Build DLLs with dotnet-cli" user_options = [ ("dotnet-config=", None, "dotnet build configuration"), ( "inplace", "i", "ignore build-lib and put compiled extensions into the source " + "directory alongside your pure Python modules", ), ] def initialize_options(self): self.dotnet_config = None self.build_lib = None self.inplace = False def finalize_options(self): if self.dotnet_config is None: self.dotnet_config = "release" build = self.distribution.get_command_obj("build") build.ensure_finalized() if self.inplace: self.build_lib = "." else: self.build_lib = build.build_lib def run(self): dotnet_modules = self.distribution.dotnet_libs for lib in dotnet_modules: output = os.path.join( os.path.abspath(self.build_lib), lib.args.pop("output") ) rename = lib.args.pop("rename", {}) opts = sum( [ ["--" + name.replace("_", "-"), value] for name, value in lib.args.items() ], [], ) opts.extend(["--configuration", self.dotnet_config]) opts.extend(["--output", output]) self.announce("Running dotnet build...", level=distutils.log.INFO) self.spawn(["dotnet", "build", lib.path] + opts) for k, v in rename.items(): source = os.path.join(output, k) dest = os.path.join(output, v) if os.path.isfile(source): try: os.remove(dest) except OSError: pass self.move_file(src=source, dst=dest, level=distutils.log.INFO) else: self.warn( "Can't find file to rename: {}, current dir: {}".format( source, os.getcwd() ) ) # Add build_dotnet to the build tasks:class build(_build): sub_commands = _build.sub_commands + [("build_dotnet", None)] class develop(_develop): def install_for_development(self): # Build extensions in-place self.reinitialize_command("build_dotnet", inplace=1) self.run_command("build_dotnet") return super().install_for_development() class bdist_wheel(_bdist_wheel): def finalize_options(self): # Monkey patch bdist_wheel to think the package is pure even though we # include DLLs super().finalize_options() self.root_is_pure = True # Monkey-patch Distribution s.t. it supports the dotnet_libs attributeDistribution.dotnet_libs = None cmdclass = { "build": build, "build_dotnet": build_dotnet, "develop": develop, "bdist_wheel": bdist_wheel,} dotnet_libs = [ DotnetLib( "python-runtime", "src/runtime/Python.Runtime.csproj", output="pythonnet/runtime", )] setup( cmdclass=cmdclass, dotnet_libs=dotnet_libs,) You can’t perform that action at this time.