3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 20:18:18 +00:00

replace all non-portable filepath slashes with os.path.join

This commit is contained in:
Andrew Dutcher 2016-09-14 14:19:10 -07:00
parent 02783d0bfb
commit 02217d048b
3 changed files with 12 additions and 13 deletions

View file

@ -98,7 +98,7 @@ def mk_z3consts_py_internal(api_files, output_dir):
openbrace_pat = re.compile("{ *") openbrace_pat = re.compile("{ *")
closebrace_pat = re.compile("}.*;") closebrace_pat = re.compile("}.*;")
z3consts = open(os.path.join(output_dir, 'z3/z3consts.py'), 'w') z3consts = open(os.path.join(output_dir, 'z3', 'z3consts.py'), 'w')
z3consts_output_path = z3consts.name z3consts_output_path = z3consts.name
z3consts.write('# Automatically generated file\n\n') z3consts.write('# Automatically generated file\n\n')
for api_file in api_files: for api_file in api_files:

View file

@ -1708,7 +1708,7 @@ def generate_files(api_files,
with mk_file_or_temp(api_output_dir, 'api_log_macros.h') as log_h: with mk_file_or_temp(api_output_dir, 'api_log_macros.h') as log_h:
with mk_file_or_temp(api_output_dir, 'api_log_macros.cpp') as log_c: with mk_file_or_temp(api_output_dir, 'api_log_macros.cpp') as log_c:
with mk_file_or_temp(api_output_dir, 'api_commands.cpp') as exe_c: with mk_file_or_temp(api_output_dir, 'api_commands.cpp') as exe_c:
with mk_file_or_temp(z3py_output_dir, 'z3/z3core.py') as core_py: with mk_file_or_temp(z3py_output_dir, os.path.join('z3', 'z3core.py')) as core_py:
# Write preambles # Write preambles
write_log_h_preamble(log_h) write_log_h_preamble(log_h)
write_log_c_preamble(log_c) write_log_c_preamble(log_c)

View file

@ -18,7 +18,7 @@ build_env['CXXFLAGS'] = "-std=c++11"
ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
SRC_DIR_LOCAL = os.path.join(ROOT_DIR, 'core') SRC_DIR_LOCAL = os.path.join(ROOT_DIR, 'core')
SRC_DIR_REPO = os.path.join(ROOT_DIR, '../../..') SRC_DIR_REPO = os.path.join(ROOT_DIR, '..', '..', '..')
SRC_DIR = SRC_DIR_LOCAL if os.path.exists(SRC_DIR_LOCAL) else SRC_DIR_REPO SRC_DIR = SRC_DIR_LOCAL if os.path.exists(SRC_DIR_LOCAL) else SRC_DIR_REPO
BUILD_DIR = os.path.join(SRC_DIR, 'build') # implicit in configure script BUILD_DIR = os.path.join(SRC_DIR, 'build') # implicit in configure script
LIBS_DIR = os.path.join(ROOT_DIR, 'z3', 'lib') LIBS_DIR = os.path.join(ROOT_DIR, 'z3', 'lib')
@ -72,8 +72,8 @@ def _copy_bins():
_clean_bins() _clean_bins()
if SRC_DIR == SRC_DIR_LOCAL: if SRC_DIR == SRC_DIR_LOCAL:
shutil.copy(os.path.join(SRC_DIR, 'src/api/python/z3/z3core.py'), os.path.join(ROOT_DIR, 'z3')) shutil.copy(os.path.join(SRC_DIR, 'src', 'api', 'python', 'z3', 'z3core.py'), os.path.join(ROOT_DIR, 'z3'))
shutil.copy(os.path.join(SRC_DIR, 'src/api/python/z3/z3consts.py'), os.path.join(ROOT_DIR, 'z3')) shutil.copy(os.path.join(SRC_DIR, 'src', 'api', 'python', 'z3', 'z3consts.py'), os.path.join(ROOT_DIR, 'z3'))
# STEP 2: Copy the shared library, the executable and the headers # STEP 2: Copy the shared library, the executable and the headers
@ -83,8 +83,8 @@ def _copy_bins():
os.mkdir(os.path.join(HEADERS_DIR, 'c++')) os.mkdir(os.path.join(HEADERS_DIR, 'c++'))
shutil.copy(os.path.join(BUILD_DIR, 'libz3.so'), LIBS_DIR) shutil.copy(os.path.join(BUILD_DIR, 'libz3.so'), LIBS_DIR)
shutil.copy(os.path.join(BUILD_DIR, 'z3'), BINS_DIR) shutil.copy(os.path.join(BUILD_DIR, 'z3'), BINS_DIR)
for fname in ('z3.h', 'z3_v1.h', 'z3_macros.h', 'z3_api.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h', 'z3_interp.h', 'z3_fpa.h', 'c++/z3++.h'): for fname in ('z3.h', 'z3_v1.h', 'z3_macros.h', 'z3_api.h', 'z3_algebraic.h', 'z3_polynomial.h', 'z3_rcf.h', 'z3_interp.h', 'z3_fpa.h', os.path.join('c++', 'z3++.h')):
shutil.copy(os.path.join(SRC_DIR, 'src/api', fname), os.path.join(HEADERS_DIR, fname)) shutil.copy(os.path.join(SRC_DIR, 'src', 'api', fname), os.path.join(HEADERS_DIR, fname))
def _copy_sources(): def _copy_sources():
""" """
@ -101,9 +101,9 @@ def _copy_sources():
ignore=lambda src, names: ['python'] if 'api' in src else []) ignore=lambda src, names: ['python'] if 'api' in src else [])
# stub python dir to make build happy # stub python dir to make build happy
os.mkdir(os.path.join(SRC_DIR_LOCAL, 'src/api/python')) os.mkdir(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python'))
os.mkdir(os.path.join(SRC_DIR_LOCAL, 'src/api/python/z3')) os.mkdir(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python', 'z3'))
open(os.path.join(SRC_DIR_LOCAL, 'src/api/python/z3/.placeholder'), 'w').close() open(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python', 'z3', '.placeholder'), 'w').close()
class build(_build): class build(_build):
def run(self): def run(self):
@ -148,9 +148,8 @@ setup(
packages=['z3'], packages=['z3'],
include_package_data=True, include_package_data=True,
package_data={ package_data={
'z3': ['lib/*', 'include/*'] 'z3': [os.path.join('lib', '*'), os.path.join('include', '*')]
}, },
scripts=['bin/z3'], scripts=[os.path.join('bin', 'z3')],
#scripts=[os.path.join(ROOT_DIR, 'build', 'z3')] if sys.version_info[0] == 2 else [],
cmdclass={'build': build, 'develop': develop, 'sdist': sdist, 'bdist_egg': bdist_egg}, cmdclass={'build': build, 'develop': develop, 'sdist': sdist, 'bdist_egg': bdist_egg},
) )