4

I have a library which needs a precompiled extension modlue. Consider following file layout:

lib
  |--- win32_py32
  |       |--- _lib.py
  |---- win32_py32
          |--- _lib.py

How can I build 2 different wheel-packages which only contains the correct binary depending on the platform?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Razer
  • 7,843
  • 16
  • 55
  • 103

1 Answers1

3

I would do something like this:

lib
 |------ lib.py
 |------ platform_1
 |           |------- _lib.py
 |           
 |------ platform_2
 |           |------- _lib.py

and in lib.py

# this module becomes the _lib module for one platform of either 1 or 2
if platform == 1:
    from .platform_1._lib import * # python 3 import
if platform == 2:
    from .platform_2._lib import *
User
  • 14,131
  • 2
  • 40
  • 59