Skip to content

Commit

Permalink
fixed #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Weidauer committed Mar 28, 2024
1 parent 09149ac commit 03aefb8
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,45 @@ else
install_postfix = ''
endif

venv_path = get_option('prefix') / get_option('datadir') / ('osc-kreuz' + install_postfix) / 'venv'
install_venv_path = get_option('prefix') / get_option('datadir') / ('osc-kreuz' + install_postfix) / 'venv'
build_venv_path = meson.current_source_dir() / 'venv'
wheel_name = 'osc_kreuz-' + meson.project_version() + '-py3-none-any.whl'

# creating virtual environments
meson.add_install_script(
'sh', '-c',
'sudo python3 -m venv @0@; '.format(venv_path)
)
# --- build python wheel
# create venv (does nothing if it already exists)
run_command('python3', '-m', 'venv', build_venv_path, check: true)

meson.add_install_script(
'sh', '-c',
'python3 -m venv @0@; '.format(build_venv_path)
)
# install build
run_command('@0@/bin/pip'.format(build_venv_path), 'install', 'build', check: true)

# build python wheel
meson.add_install_script(
'sh', '-c',
'@0@/bin/pip install build;'.format(build_venv_path)
)
# build wheel
run_command('@0@/bin/python3'.format(build_venv_path), '-m', 'build', '--wheel', meson.current_source_dir(), check: true)


# --- install osc-kreuz with pip

# create virtual environment
meson.add_install_script(
'sh', '-c',
'@0@/bin/python3 -m build --wheel @1@'.format(build_venv_path, meson.current_source_dir())
'sudo python3 -m venv @0@; '.format(install_venv_path)
)

# installing osc-kreuz with pip
# uses pip of the created virtual environment
# use pip of the created virtual environment to install the wheel
meson.add_install_script(
'sh', '-c',
'sudo @0@/bin/pip install @1@; '.format(
venv_path, meson.current_source_dir() / 'dist' / wheel_name)
install_venv_path, meson.current_source_dir() / 'dist' / wheel_name)
)

# linking osc-kreuz binary to bindir
# symlink osc-kreuz binary to bindir
meson.add_install_script(
'sh', '-c',
'sudo ln -s -f @0@ @1@'.format(
venv_path / 'bin' / 'osc-kreuz',
install_venv_path / 'bin' / 'osc-kreuz',
get_option('prefix') / get_option('bindir') / 'osc-kreuz' + install_postfix)
)

if get_option('versioned_install')
# linking osc-kreuz binary to bindir
# symlink version specific osc-kreuz binary to bindir
meson.add_install_script(
'sh', '-c',
'sudo ln -s -f @0@ @1@'.format(
Expand Down

0 comments on commit 03aefb8

Please sign in to comment.