mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-03-04 20:39:50 +00:00
Update building script to copy source files to build directory if missing.
This commit is contained in:
parent
05522dcb8c
commit
f217d2872f
3
bindings/python/.gitignore
vendored
Normal file
3
bindings/python/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
MANIFEST
|
||||
dist/
|
||||
src/
|
@ -32,10 +32,13 @@ def get_sources():
|
||||
create the library.
|
||||
"""
|
||||
result = []
|
||||
# Make the src directory if it does not exist.
|
||||
if not os.access("./src/", os.F_OK):
|
||||
custom_sdist.copy_sources()
|
||||
|
||||
for root, _, files in os.walk("./src/"):
|
||||
for name in files:
|
||||
if name.endswith(".c") or name.endswith(".h") or \
|
||||
name.endswith(".inc") or root == "./src/":
|
||||
if name.endswith(".c"):
|
||||
result.append(os.path.join(root, name))
|
||||
|
||||
return result
|
||||
@ -48,7 +51,8 @@ class custom_sdist(sdist):
|
||||
self.copy_sources()
|
||||
return sdist.run(self)
|
||||
|
||||
def copy_sources(self):
|
||||
@staticmethod
|
||||
def copy_sources():
|
||||
"""Copy the C sources into the source directory.
|
||||
|
||||
This rearranges the source files under the python distribution
|
||||
@ -58,7 +62,7 @@ class custom_sdist(sdist):
|
||||
|
||||
try:
|
||||
dir_util.remove_tree("src/")
|
||||
except:
|
||||
except (IOError, OSError):
|
||||
pass
|
||||
dir_util.copy_tree("../../arch", "src/arch/")
|
||||
dir_util.copy_tree("../../include", "src/include/")
|
||||
|
Loading…
x
Reference in New Issue
Block a user