Loading MANIFEST.in +2 −0 Original line number Diff line number Diff line include Makefile include src/*.c include include/*.h No newline at end of file Makefile +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ CC := gcc LD := gcc MAKE := /usr/bin/make MKDIR_P := mkdir -p PWD := pwd # Libraries LIBS := -lbinary_c $(shell $(BINARY_C)/binary_c-config --libs) Loading @@ -41,6 +42,7 @@ OBJ_FLAGS := -c # Shared lib files and flags SO_NAME := $(TARGET_LIB_DIR)/libbinary_c_python_api.so SO_FLAGS := -shared SO_NAME_EXTRA := binarycpython/libbinary_c_python_api.so all: create_directories create_objects create_library Loading @@ -57,7 +59,9 @@ create_objects_debug: $(CC) -DBINARY_C=$(BINARY_C) -DBINARY_C_PYTHON_DEBUG $(CFLAGS) $(INCDIRS) $(C_SRC) -o $(OBJECTS) $(OBJ_FLAGS) $(LIBS) create_library: @echo $(PWD) $(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS) $(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME_EXTRA) $(OBJECTS) create_library_debug: $(CC) -DBINARY_C=$(BINARY_C) -DBINARY_C_PYTHON_DEBUG $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS) Loading setup.py +37 −26 Original line number Diff line number Diff line Loading @@ -16,10 +16,16 @@ import distutils.command.build # Functions def readme(): """Opens readme file and returns content""" with open("README.md") as file: with open("README") as file: return file.read() # def readme_rst(): # """Opens readme file and returns contents converted to rst""" # with open("README.md") as file: # return md_to_rst.convertMarkdownToRst(file.read()) def license(): """Opens license file and returns the content""" with open("LICENSE.md") as file: Loading @@ -37,6 +43,7 @@ def check_version(installed_binary_c_version, required_binary_c_versions): ) assert installed_binary_c_version in required_binary_c_versions, message def execute_make(): """ Function to execute the makefile. Loading @@ -53,7 +60,7 @@ def execute_make(): if p.returncode != 0: print("Something went wrong when executing the makefile:") print(stderr.decode('utf-8')) print(stderr.decode("utf-8")) print("Aborting") sys.exit(-1) Loading @@ -62,7 +69,6 @@ def execute_make(): print("Successfully built the libbinary_c_api.so") ### REQUIRED_BINARY_C_VERSIONS = ["2.1.7"] Loading Loading @@ -160,12 +166,14 @@ INCLUDE_DIRS = ( else [] ) LIBRARIES = ["binary_c"] + BINARY_C_LIBS + ["binary_c_python_api"] # LIBRARIES = ["binary_c"] + BINARY_C_LIBS + ["binary_c_python_api"] LIBRARIES = ["binary_c"] + BINARY_C_LIBS LIBRARY_DIRS = [ os.path.join(BINARY_C_DIR, "src"), "./", os.path.join(CWD, "lib/"), os.path.join(CWD, "binarycpython/"), ] + BINARY_C_LIBDIRS RUNTIME_LIBRARY_DIRS = [ Loading Loading @@ -219,17 +227,17 @@ BINARY_C_PYTHON_API_MODULE = Extension( # Override build command class CustomBuildCommand(distutils.command.build.build): def run(self): execute_make() # execute_make() # Run the original build command # print(super().run()) distutils.command.build.build.run(self) setup( name="binarycpython", version="0.2", version="0.2.1", description=""" This is a python API for binary_c (versions {}) by David Hendriks, Rob Izzard and collaborators. Based on the initial set up by Jeff andrews. Loading @@ -237,26 +245,31 @@ setup( If you want to use a different version of binary_c, download and install a different version of this package """.format( str(REQUIRED_BINARY_C_VERSIONS), str(REQUIRED_BINARY_C_VERSIONS) ",".join(str(REQUIRED_BINARY_C_VERSIONS)), ",".join(str(REQUIRED_BINARY_C_VERSIONS)), ), author="David Hendriks", author_email="davidhendriks93@gmail.com", long_description_content_type='text/markdown', long_description=readme(), # long_description=readme(), long_description="hello", url="https://gitlab.eps.surrey.ac.uk/ri0005/binary_c-python", license="gpl", keywords = ['binary_c', 'astrophysics', 'stellar evolution', 'population synthesis'], # Keywords that define your package best keywords=[ "binary_c", "astrophysics", "stellar evolution", "population synthesis", ], # Keywords that define your package best packages=[ "binarycpython", "binarycpython.utils", "binarycpython.core", "binarycpython.tests", "binarycpython.tests.core", "binarycpython.tests.c_bindings", ], install_requires=["numpy", "pytest", "h5py"], include_package_data=True, ext_modules=[BINARY_C_PYTHON_API_MODULE], # binary_c must be loaded classifiers=[ "Development Status :: 3 - Alpha", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", Loading @@ -269,7 +282,5 @@ setup( "Topic :: Scientific/Engineering :: Physics", "Topic :: Software Development :: Libraries :: Python Modules", ], cmdclass={'build': CustomBuildCommand}, cmdclass={"build": CustomBuildCommand}, ) Loading
MANIFEST.in +2 −0 Original line number Diff line number Diff line include Makefile include src/*.c include include/*.h No newline at end of file
Makefile +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ CC := gcc LD := gcc MAKE := /usr/bin/make MKDIR_P := mkdir -p PWD := pwd # Libraries LIBS := -lbinary_c $(shell $(BINARY_C)/binary_c-config --libs) Loading @@ -41,6 +42,7 @@ OBJ_FLAGS := -c # Shared lib files and flags SO_NAME := $(TARGET_LIB_DIR)/libbinary_c_python_api.so SO_FLAGS := -shared SO_NAME_EXTRA := binarycpython/libbinary_c_python_api.so all: create_directories create_objects create_library Loading @@ -57,7 +59,9 @@ create_objects_debug: $(CC) -DBINARY_C=$(BINARY_C) -DBINARY_C_PYTHON_DEBUG $(CFLAGS) $(INCDIRS) $(C_SRC) -o $(OBJECTS) $(OBJ_FLAGS) $(LIBS) create_library: @echo $(PWD) $(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS) $(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME_EXTRA) $(OBJECTS) create_library_debug: $(CC) -DBINARY_C=$(BINARY_C) -DBINARY_C_PYTHON_DEBUG $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS) Loading
setup.py +37 −26 Original line number Diff line number Diff line Loading @@ -16,10 +16,16 @@ import distutils.command.build # Functions def readme(): """Opens readme file and returns content""" with open("README.md") as file: with open("README") as file: return file.read() # def readme_rst(): # """Opens readme file and returns contents converted to rst""" # with open("README.md") as file: # return md_to_rst.convertMarkdownToRst(file.read()) def license(): """Opens license file and returns the content""" with open("LICENSE.md") as file: Loading @@ -37,6 +43,7 @@ def check_version(installed_binary_c_version, required_binary_c_versions): ) assert installed_binary_c_version in required_binary_c_versions, message def execute_make(): """ Function to execute the makefile. Loading @@ -53,7 +60,7 @@ def execute_make(): if p.returncode != 0: print("Something went wrong when executing the makefile:") print(stderr.decode('utf-8')) print(stderr.decode("utf-8")) print("Aborting") sys.exit(-1) Loading @@ -62,7 +69,6 @@ def execute_make(): print("Successfully built the libbinary_c_api.so") ### REQUIRED_BINARY_C_VERSIONS = ["2.1.7"] Loading Loading @@ -160,12 +166,14 @@ INCLUDE_DIRS = ( else [] ) LIBRARIES = ["binary_c"] + BINARY_C_LIBS + ["binary_c_python_api"] # LIBRARIES = ["binary_c"] + BINARY_C_LIBS + ["binary_c_python_api"] LIBRARIES = ["binary_c"] + BINARY_C_LIBS LIBRARY_DIRS = [ os.path.join(BINARY_C_DIR, "src"), "./", os.path.join(CWD, "lib/"), os.path.join(CWD, "binarycpython/"), ] + BINARY_C_LIBDIRS RUNTIME_LIBRARY_DIRS = [ Loading Loading @@ -219,17 +227,17 @@ BINARY_C_PYTHON_API_MODULE = Extension( # Override build command class CustomBuildCommand(distutils.command.build.build): def run(self): execute_make() # execute_make() # Run the original build command # print(super().run()) distutils.command.build.build.run(self) setup( name="binarycpython", version="0.2", version="0.2.1", description=""" This is a python API for binary_c (versions {}) by David Hendriks, Rob Izzard and collaborators. Based on the initial set up by Jeff andrews. Loading @@ -237,26 +245,31 @@ setup( If you want to use a different version of binary_c, download and install a different version of this package """.format( str(REQUIRED_BINARY_C_VERSIONS), str(REQUIRED_BINARY_C_VERSIONS) ",".join(str(REQUIRED_BINARY_C_VERSIONS)), ",".join(str(REQUIRED_BINARY_C_VERSIONS)), ), author="David Hendriks", author_email="davidhendriks93@gmail.com", long_description_content_type='text/markdown', long_description=readme(), # long_description=readme(), long_description="hello", url="https://gitlab.eps.surrey.ac.uk/ri0005/binary_c-python", license="gpl", keywords = ['binary_c', 'astrophysics', 'stellar evolution', 'population synthesis'], # Keywords that define your package best keywords=[ "binary_c", "astrophysics", "stellar evolution", "population synthesis", ], # Keywords that define your package best packages=[ "binarycpython", "binarycpython.utils", "binarycpython.core", "binarycpython.tests", "binarycpython.tests.core", "binarycpython.tests.c_bindings", ], install_requires=["numpy", "pytest", "h5py"], include_package_data=True, ext_modules=[BINARY_C_PYTHON_API_MODULE], # binary_c must be loaded classifiers=[ "Development Status :: 3 - Alpha", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", Loading @@ -269,7 +282,5 @@ setup( "Topic :: Scientific/Engineering :: Physics", "Topic :: Software Development :: Libraries :: Python Modules", ], cmdclass={'build': CustomBuildCommand}, cmdclass={"build": CustomBuildCommand}, )