diff --git a/scripts/mk_genfile_common.py b/scripts/mk_genfile_common.py index 2ecb06776..7e7cb5584 100644 --- a/scripts/mk_genfile_common.py +++ b/scripts/mk_genfile_common.py @@ -98,7 +98,7 @@ def mk_z3consts_py_internal(api_files, output_dir): openbrace_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.write('# Automatically generated file\n\n') for api_file in api_files: diff --git a/scripts/update_api.py b/scripts/update_api.py index 48a4d6114..d8b2bec58 100755 --- a/scripts/update_api.py +++ b/scripts/update_api.py @@ -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.cpp') as log_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_log_h_preamble(log_h) write_log_c_preamble(log_c) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index a43ded92e..c6d7d8824 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -18,7 +18,7 @@ build_env['CXXFLAGS'] = "-std=c++11" ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) 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 BUILD_DIR = os.path.join(SRC_DIR, 'build') # implicit in configure script LIBS_DIR = os.path.join(ROOT_DIR, 'z3', 'lib') @@ -72,8 +72,8 @@ def _copy_bins(): _clean_bins() 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/z3consts.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')) # 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++')) shutil.copy(os.path.join(BUILD_DIR, 'libz3.so'), LIBS_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'): - shutil.copy(os.path.join(SRC_DIR, 'src/api', fname), os.path.join(HEADERS_DIR, fname)) + 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)) def _copy_sources(): """ @@ -101,9 +101,9 @@ def _copy_sources(): ignore=lambda src, names: ['python'] if 'api' in src else []) # 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/z3')) - open(os.path.join(SRC_DIR_LOCAL, 'src/api/python/z3/.placeholder'), 'w').close() + os.mkdir(os.path.join(SRC_DIR_LOCAL, 'src', 'api', 'python')) + 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() class build(_build): def run(self): @@ -148,9 +148,8 @@ setup( packages=['z3'], include_package_data=True, package_data={ - 'z3': ['lib/*', 'include/*'] + 'z3': [os.path.join('lib', '*'), os.path.join('include', '*')] }, - scripts=['bin/z3'], - #scripts=[os.path.join(ROOT_DIR, 'build', 'z3')] if sys.version_info[0] == 2 else [], + scripts=[os.path.join('bin', 'z3')], cmdclass={'build': build, 'develop': develop, 'sdist': sdist, 'bdist_egg': bdist_egg}, )