|
1 | 1 | #!/usr/bin/env python
|
2 | 2 |
|
3 |
| -from distutils.core import setup |
| 3 | +from setuptools import setup, find_packages |
| 4 | +from distutils.cmd import Command |
| 5 | + |
| 6 | + |
| 7 | +class DotnetLib: |
| 8 | + def __init__(self, path, **kwargs): |
| 9 | + self.path = path |
| 10 | + self.args = kwargs |
| 11 | + |
| 12 | + |
| 13 | +class BuildDotnet(Command): |
| 14 | + """Build command for dotnet-cli based builds""" |
| 15 | + |
| 16 | + description = "Build DLLs with dotnet-cli" |
| 17 | + user_options = [("dotnet-config", None, "dotnet build configuration")] |
| 18 | + |
| 19 | + def initialize_options(self): |
| 20 | + self.dotnet_config = "release" |
| 21 | + |
| 22 | + def finalize_options(self): |
| 23 | + pass |
| 24 | + |
| 25 | + def run(self): |
| 26 | + # self.spawn(["./build_netfx_loader.sh"]) |
| 27 | + for lib in self.distribution.ext_modules: |
| 28 | + opts = sum( |
| 29 | + [ |
| 30 | + ["--" + name.replace("_", "-"), value] |
| 31 | + for name, value in lib.args.items() |
| 32 | + ], |
| 33 | + [], |
| 34 | + ) |
| 35 | + |
| 36 | + opts.append("--configuration") |
| 37 | + opts.append(self.dotnet_config) |
| 38 | + |
| 39 | + self.spawn(["dotnet", "build", lib.path] + opts) |
| 40 | + |
| 41 | + |
| 42 | +with open("README.md", "r") as f: |
| 43 | + long_description = f.read() |
4 | 44 |
|
5 | 45 | setup(
|
6 | 46 | name="clr_loader",
|
7 | 47 | version="0.1.0",
|
8 | 48 | description="Generic pure Python loader for .NET runtimes",
|
9 | 49 | author="Benedikt Reinartz",
|
10 | 50 |
|
| 51 | + long_description=long_description, |
| 52 | + long_description_content_type="text/markdown", |
11 | 53 | license="MIT",
|
12 | 54 | install_requires=["cffi"],
|
13 | 55 | classifiers=[
|
|
19 | 61 | "Operating System :: POSIX :: Linux",
|
20 | 62 | "Operating System :: MacOS :: MacOS X",
|
21 | 63 | ],
|
22 |
| - package_data={"clr_loader.ffi": ["dlls/x86/*", "dlls/amd64/*"]}, |
23 |
| - packages=["clr_loader", "clr_loader.ffi", "clr_loader.util"], |
| 64 | + package_data={"clr_loader.ffi": ["dlls/x86/*.dll", "dlls/amd64/*.dll"]}, |
| 65 | + packages=find_packages(), |
| 66 | + cmdclass={"build_ext": BuildDotnet}, |
| 67 | + ext_modules={ |
| 68 | + DotnetLib("netfx_loader/", runtime="win-x86", output="clr_loader/ffi/dlls/x86"), |
| 69 | + DotnetLib( |
| 70 | + "netfx_loader/", runtime="win-x64", output="clr_loader/ffi/dlls/amd64" |
| 71 | + ), |
| 72 | + }, |
24 | 73 | )
|
0 commit comments