Delete 'setup.py'
This commit is contained in:
parent
45a18927b4
commit
ce102956f2
55
setup.py
55
setup.py
|
@ -1,55 +0,0 @@
|
|||
# coding:utf-8
|
||||
import os.path
|
||||
import subprocess
|
||||
from setuptools import setup, Extension
|
||||
from setuptools.command.build_ext import build_ext
|
||||
from distutils.sysconfig import get_python_inc
|
||||
|
||||
class CMakeExtension(Extension):
|
||||
def __init__(self, name, sourcedir=""):
|
||||
Extension.__init__(self, name, sources=[])
|
||||
self.sourcedir = os.path.abspath(sourcedir)
|
||||
|
||||
class CMakeBuild(build_ext):
|
||||
def run(self):
|
||||
for ext in self.extensions:
|
||||
self.build_extension(ext)
|
||||
|
||||
def build_extension(self, ext):
|
||||
extdir = self.get_ext_fullpath(ext.name)
|
||||
extname = self.get_ext_filename(ext.name)
|
||||
if not os.path.exists(self.build_temp):
|
||||
os.makedirs(self.build_temp)
|
||||
install_prefix = os.path.abspath(os.path.dirname(extdir))
|
||||
if not os.path.exists(install_prefix):
|
||||
os.makedirs(install_prefix)
|
||||
cmake_args = []
|
||||
cmake_args.append('-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}'.format(install_prefix))
|
||||
extname = extname[:-3] # remove .so
|
||||
cmake_args.append("-DPY_NAME={}".format(extname))
|
||||
pyinc = get_python_inc()
|
||||
import numpy as np
|
||||
npinc = np.get_include()
|
||||
cmake_args.append("-DPYTHONINC={}".format(pyinc))
|
||||
cmake_args.append("-DNPINC={}".format(npinc))
|
||||
subprocess.check_call(['cmake', ext.sourcedir, *cmake_args], cwd=self.build_temp)
|
||||
subprocess.check_call(['make', '-j32'], cwd=self.build_temp)
|
||||
self.write_stub(".", ext)
|
||||
# self.copy_extensions_to_source()
|
||||
|
||||
|
||||
|
||||
setup(
|
||||
install_requires=['numpy'],
|
||||
name='dbsecmpc', # 包名字
|
||||
version='1.0', # 包版本
|
||||
description='', # 简单描述
|
||||
author='dbsec', # 作者
|
||||
author_email='yanghao@dbsec.com', # 作者邮箱
|
||||
packages=["dbsecmpc"],
|
||||
url='', # 包的主页
|
||||
ext_modules=[CMakeExtension("dbsec")],
|
||||
cmdclass={
|
||||
'build_ext': CMakeBuild,
|
||||
}
|
||||
)
|
Loading…
Reference in New Issue