From 24586e60aa56044e9f836e18f2d8f1f700550592 Mon Sep 17 00:00:00 2001 From: Philippe Tillet Date: Mon, 4 May 2020 10:43:38 -0400 Subject: [PATCH] [PACKAGING] sdist now generates working .tar.gz file --- CMakeLists.txt | 4 ++-- python/setup.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d0ad62eb..cef253883 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,8 +33,8 @@ endif() if(BUILD_PYTHON_MODULE) message(STATUS "Adding Python module") # PyBind11 wrapper source file - file(GLOB_RECURSE PYTHON_SRC python/src/bindings.cc) - include_directories(python/src/ ${PYTHON_INCLUDE_DIRS}) + set(PYTHON_SRC bindings.cc) + include_directories("." ${PYTHON_INCLUDE_DIRS}) endif() diff --git a/python/setup.py b/python/setup.py index 12b144765..d867dc122 100644 --- a/python/setup.py +++ b/python/setup.py @@ -35,8 +35,6 @@ class CMakeExtension(Extension): self.path = path -prefix = os.pardir - class CMakeBuild(build_ext): def run(self): @@ -63,6 +61,8 @@ class CMakeBuild(build_ext): cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, '-DBUILD_TESTS=OFF', '-DBUILD_PYTHON_MODULE=ON', + #'-DPYTHON_EXECUTABLE=' + sys.executable, + #'-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON, '-DPYTHON_INCLUDE_DIRS=' + python_include_dirs, '-DLLVM_CONFIG=' + find_llvm()] # configuration @@ -84,19 +84,19 @@ class CMakeBuild(build_ext): self.distribution.get_version()) if not os.path.exists(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', '--build', '.'] + build_args, cwd=self.build_temp) 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 = [] for d in directories: for htype in ['h', 'hpp']: 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( name='triton',