8000 Bug in setup.py for build_dotnet step · Issue #1631 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content
Bug in setup.py for build_dotnet step #1631
Closed
@bpdavis86

Description

@bpdavis86

Environment

  • Pythonnet version: master bc5b084
  • Python version: 3.8
  • Operating System: Windows 10
  • .NET Runtime: N/A

Details

  • Describe what you were trying to get done.

I was trying to track down a bug in my code by breaking into pythonnet in Visual Studio. This necessitated a debug build. The setup.py appears to provide this option in the build_dotnet step through the --dotnet-config option. Unfortunately, this option is broken as currently implemented.

$ python setup.py build_dotnet --dotnet-config=debug
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --dotnet-config must not have an argument
  • If there was a crash, please include the traceback here.

See above.

  • Solution

I was able to fix this by modifying setup.py:24-36 to

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",
        ),
    ]

The key is the = sign after the dotnet-config option.

With this change, the debug build proceeded correctly.

$ python setup.py build_dotnet --dotnet-config=debug
running build_dotnet
Running dotnet build...
C:\Program Files\dotnet\dotnet.exe build src/runtime/Python.Runtime.csproj --configuration debug --output C:\Code\pythonnet\build\lib\pythonnet/runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0