Python packaging is hard...
This commit is contained in:
Родитель
ea7137dbf2
Коммит
9ea6e5feb9
|
@ -0,0 +1,2 @@
|
|||
include netfx_loader/*.sln netfx_loader/*.csproj netfx_loader/*.cs
|
||||
recursive-exclude clr_loader/ffi/dlls *.dll
|
|
@ -0,0 +1,2 @@
|
|||
[metadata]
|
||||
license_file = LICENSE
|
36
setup.py
36
setup.py
|
@ -1,13 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from distutils.cmd import Command
|
||||
from setuptools import setup, find_packages, Command, Extension
|
||||
from wheel.bdist_wheel import bdist_wheel
|
||||
|
||||
|
||||
class DotnetLib:
|
||||
def __init__(self, path, **kwargs):
|
||||
class DotnetLib(Extension):
|
||||
def __init__(self, name, path, **kwargs):
|
||||
self.path = path
|
||||
self.args = kwargs
|
||||
super().__init__(name, sources=[])
|
||||
|
||||
|
||||
class BuildDotnet(Command):
|
||||
|
@ -22,8 +23,10 @@ class BuildDotnet(Command):
|
|||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def get_source_files(self):
|
||||
return []
|
||||
|
||||
def run(self):
|
||||
# self.spawn(["./build_netfx_loader.sh"])
|
||||
for lib in self.distribution.ext_modules:
|
||||
opts = sum(
|
||||
[
|
||||
|
@ -39,6 +42,14 @@ class BuildDotnet(Command):
|
|||
self.spawn(["dotnet", "build", lib.path] + opts)
|
||||
|
||||
|
||||
class bdist_wheel_patched(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
|
||||
|
||||
|
||||
with open("README.md", "r") as f:
|
||||
long_description = f.read()
|
||||
|
||||
|
@ -51,6 +62,7 @@ setup(
|
|||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
license="MIT",
|
||||
python_requires=">=3.3",
|
||||
install_requires=["cffi"],
|
||||
classifiers=[
|
||||
"Development Status :: 2 - Pre-Alpha",
|
||||
|
@ -63,11 +75,19 @@ setup(
|
|||
],
|
||||
package_data={"clr_loader.ffi": ["dlls/x86/*.dll", "dlls/amd64/*.dll"]},
|
||||
packages=find_packages(),
|
||||
cmdclass={"build_ext": BuildDotnet},
|
||||
cmdclass={"build_ext": BuildDotnet, "bdist_wheel": bdist_wheel_patched},
|
||||
ext_modules={
|
||||
DotnetLib("netfx_loader/", runtime="win-x86", output="clr_loader/ffi/dlls/x86"),
|
||||
DotnetLib(
|
||||
"netfx_loader/", runtime="win-x64", output="clr_loader/ffi/dlls/amd64"
|
||||
"netfx-loader-x86",
|
||||
"netfx_loader/",
|
||||
runtime="win-x86",
|
||||
output="clr_loader/ffi/dlls/x86",
|
||||
),
|
||||
DotnetLib(
|
||||
"netfx-loader-amd64",
|
||||
"netfx_loader/",
|
||||
runtime="win-x64",
|
||||
output="clr_loader/ffi/dlls/amd64",
|
||||
),
|
||||
},
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче