[PACKAGING] sdist now generates working .tar.gz file

This commit is contained in:
Philippe Tillet
2020-05-04 10:43:38 -04:00
committed by Philippe Tillet
parent 769c1180c5
commit 24586e60aa
2 changed files with 7 additions and 7 deletions

View File

@@ -33,8 +33,8 @@ endif()
if(BUILD_PYTHON_MODULE) if(BUILD_PYTHON_MODULE)
message(STATUS "Adding Python module") message(STATUS "Adding Python module")
# PyBind11 wrapper source file # PyBind11 wrapper source file
file(GLOB_RECURSE PYTHON_SRC python/src/bindings.cc) set(PYTHON_SRC bindings.cc)
include_directories(python/src/ ${PYTHON_INCLUDE_DIRS}) include_directories("." ${PYTHON_INCLUDE_DIRS})
endif() endif()

View File

@@ -35,8 +35,6 @@ class CMakeExtension(Extension):
self.path = path self.path = path
prefix = os.pardir
class CMakeBuild(build_ext): class CMakeBuild(build_ext):
def run(self): def run(self):
@@ -63,6 +61,8 @@ class CMakeBuild(build_ext):
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
'-DBUILD_TESTS=OFF', '-DBUILD_TESTS=OFF',
'-DBUILD_PYTHON_MODULE=ON', '-DBUILD_PYTHON_MODULE=ON',
#'-DPYTHON_EXECUTABLE=' + sys.executable,
#'-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON,
'-DPYTHON_INCLUDE_DIRS=' + python_include_dirs, '-DPYTHON_INCLUDE_DIRS=' + python_include_dirs,
'-DLLVM_CONFIG=' + find_llvm()] '-DLLVM_CONFIG=' + find_llvm()]
# configuration # configuration
@@ -84,19 +84,19 @@ class CMakeBuild(build_ext):
self.distribution.get_version()) self.distribution.get_version())
if not os.path.exists(self.build_temp): if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp) os.makedirs(self.build_temp)
sourcedir = os.path.abspath(os.path.join(os.path.dirname(__file__), prefix)) sourcedir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
subprocess.check_call(['cmake', sourcedir] + cmake_args, cwd=self.build_temp, env=env) subprocess.check_call(['cmake', sourcedir] + cmake_args, cwd=self.build_temp, env=env)
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp) subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
find_llvm() find_llvm()
directories = [x[0] for x in os.walk(os.path.join(prefix, 'include'))] directories = [x[0] for x in os.walk(os.path.join('src', 'include'))]
data = [] data = []
for d in directories: for d in directories:
for htype in ['h', 'hpp']: for htype in ['h', 'hpp']:
files = glob.glob(os.path.join(d, f'*.{htype}'), recursive=False) files = glob.glob(os.path.join(d, f'*.{htype}'), recursive=False)
data += [os.path.relpath(f, prefix) for f in files] data += [os.path.relpath(f, 'src') for f in files]
setup( setup(
name='triton', name='triton',