Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug in setup.py for build_dotnet step #1631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bpdavis86 opened this issue Dec 8, 2021 · 1 comment
Closed

Bug in setup.py for build_dotnet step #1631

bpdavis86 opened this issue Dec 8, 2021 · 1 comment

Comments

@bpdavis86
Copy link

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
@filmor filmor closed this as completed in a0e8cb3 Dec 13, 2021
@filmor
Copy link
Member

filmor commented Dec 13, 2021

Great, thank you :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants