[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)
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()

View File

@@ -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',