0

I'm working on improving the setup.py script for an open source package that supports various platforms.

On Linux, the package defines a setuptools.Extension for some C code that needs to be built alongside the Python code. This produces a wheel whose name indicates that it is only compatible with a particular version of CPython and a particular OS and hardware architecture.

On macOS, however, it invokes xcodebuild manually, and then includes that framework in eager_resources. Setuptools cannot detect that the resulting wheel is platform-specific, so it gives it a generic filename.

If it's possible to, I'd prefer to have setuptools build the Xcode project for me, but if not, can I somehow tell it that this is platform-specific? I was thinking I could include an empty extension, but that seems hacky.

3
  • 1
    are you familiar with over riding setuptools.command.install ? Commented Dec 27, 2019 at 22:23
  • I'm not, no. I haven't done much with setuptools before, just hacked this script to work slightly better. Commented Dec 27, 2019 at 22:27
  • 1
    stackoverflow.com/… Commented Dec 27, 2019 at 22:28

1 Answer 1

0

This is the hacky way:

# Add a dummy extension so setuptools knows this is platform-specific
try:
    os.mkdir('build')
except:
    pass
open('build/dummy.c', 'w').close()
mod1 = Extension('package._dummy', sources=['build/dummy.c'])
ext_modules.append(mod1)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.