Move building into setup.py
This commit is contained in:
Родитель
2bf7057ad6
Коммит
ea7137dbf2
|
@ -0,0 +1,3 @@
|
|||
# clr-loader
|
||||
|
||||
Implements a generic interface for loading one of the CLR (.NET) runtime implementations and calling simple functions on them.
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
S=`dirname $0`
|
||||
P=netfx_loader/
|
||||
O=$S/clr_loader/ffi/dlls/
|
||||
|
||||
mkdir -p "$O" || exit -1
|
||||
|
||||
dotnet build "$P" -r win-x86 -o "$O/x86" || exit -1
|
||||
dotnet build "$P" -r win-x64 -o "$O/amd64" || exit -1
|
55
setup.py
55
setup.py
|
@ -1,6 +1,46 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from distutils.core import setup
|
||||
from setuptools import setup, find_packages
|
||||
from distutils.cmd import Command
|
||||
|
||||
|
||||
class DotnetLib:
|
||||
def __init__(self, path, **kwargs):
|
||||
self.path = path
|
||||
self.args = kwargs
|
||||
|
||||
|
||||
class BuildDotnet(Command):
|
||||
"""Build command for dotnet-cli based builds"""
|
||||
|
||||
description = "Build DLLs with dotnet-cli"
|
||||
user_options = [("dotnet-config", None, "dotnet build configuration")]
|
||||
|
||||
def initialize_options(self):
|
||||
self.dotnet_config = "release"
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
# self.spawn(["./build_netfx_loader.sh"])
|
||||
for lib in self.distribution.ext_modules:
|
||||
opts = sum(
|
||||
[
|
||||
["--" + name.replace("_", "-"), value]
|
||||
for name, value in lib.args.items()
|
||||
],
|
||||
[],
|
||||
)
|
||||
|
||||
opts.append("--configuration")
|
||||
opts.append(self.dotnet_config)
|
||||
|
||||
self.spawn(["dotnet", "build", lib.path] + opts)
|
||||
|
||||
|
||||
with open("README.md", "r") as f:
|
||||
long_description = f.read()
|
||||
|
||||
setup(
|
||||
name="clr_loader",
|
||||
|
@ -8,6 +48,8 @@ setup(
|
|||
description="Generic pure Python loader for .NET runtimes",
|
||||
author="Benedikt Reinartz",
|
||||
author_email="filmor@gmail.com",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
license="MIT",
|
||||
install_requires=["cffi"],
|
||||
classifiers=[
|
||||
|
@ -19,6 +61,13 @@ setup(
|
|||
"Operating System :: POSIX :: Linux",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
],
|
||||
package_data={"clr_loader.ffi": ["dlls/x86/*", "dlls/amd64/*"]},
|
||||
packages=["clr_loader", "clr_loader.ffi", "clr_loader.util"],
|
||||
package_data={"clr_loader.ffi": ["dlls/x86/*.dll", "dlls/amd64/*.dll"]},
|
||||
packages=find_packages(),
|
||||
cmdclass={"build_ext": BuildDotnet},
|
||||
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"
|
||||
),
|
||||
},
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче