Handle main script as static file (with rewrite), add desktop menu entry and icon.

waf
Ben Niemann 2019-07-20 06:51:47 +02:00
parent 46d92fa81d
commit a5ffc00a9b
7 changed files with 49 additions and 24 deletions

View File

@ -46,14 +46,9 @@ def install_post_func(ctx):
def install_post(ctx):
ctx.install_runtime_pip_packages()
ctx.install_main()
def uninstall_post(ctx):
main_path = os.path.join(ctx.env.BINDIR, 'noisicaa')
if os.path.exists(main_path):
os.unlink(main_path)
if os.path.isdir(ctx.env.LIBDIR):
shutil.rmtree(ctx.env.LIBDIR)
@ -125,22 +120,3 @@ def install_runtime_pip_packages(ctx):
os.makedirs(os.path.dirname(dest_path))
shutil.copyfile(src_path, dest_path)
shutil.copystat(src_path, dest_path)
@conf
def install_main(ctx):
if not os.path.isdir(ctx.env.BINDIR):
os.makedirs(ctx.env.BINDIR)
main_path = os.path.join(ctx.env.BINDIR, 'noisicaa')
with open(main_path, 'w') as fp:
fp.write(textwrap.dedent('''\
#!/bin/bash
export NOISICAA_INSTALL_ROOT="{PREFIX}"
export NOISICAA_DATA_DIR="{DATADIR}"
export LD_LIBRARY_PATH="${{NOISICAA_INSTALL_ROOT}}/lib/noisicaa"
export PYTHONPATH="${{NOISICAA_INSTALL_ROOT}}/lib/noisicaa"
exec python{PYTHON_VERSION} -m noisicaa.editor_main "$@"
''').format(**ctx.env))
os.chmod(main_path, 0o755)

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

View File

@ -32,6 +32,7 @@ def build(ctx):
ctx.static_file('edit-beats.svg')
ctx.static_file('edit-control-points.svg')
ctx.static_file('edit-samples.svg')
ctx.static_file('noisicaa-small.png')
ctx.static_file('node-type-builtin.svg')
ctx.static_file('node-type-ladspa.svg')
ctx.static_file('node-type-lv2.svg')

8
misc/noisicaa Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
export NOISICAA_INSTALL_ROOT="{PREFIX}"
export NOISICAA_DATA_DIR="{DATADIR}"
export LD_LIBRARY_PATH="${{NOISICAA_INSTALL_ROOT}}/lib/noisicaa"
export PYTHONPATH="${{NOISICAA_INSTALL_ROOT}}/lib/noisicaa"
exec python{PYTHON_VERSION} -m noisicaa.editor_main "$@"

6
misc/noisicaa.desktop Normal file
View File

@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
Name=noisicaä
Exec={BINDIR}/noisicaa
Icon={DATADIR}/icons/noisicaa-small.png
Categories=Audio;AudioVideo;Sequencer;AudioVideoEditing;Music

33
misc/wscript Normal file
View File

@ -0,0 +1,33 @@
# -*- mode: python -*-
# @begin:license
#
# Copyright (c) 2015-2017, Benjamin Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
import os.path
def build(ctx):
ctx.static_file('noisicaa', rewrite=True, install_to=ctx.env.BINDIR, chmod=0o755)
ctx.static_file(
'noisicaa.desktop',
rewrite=True,
install_to=os.path.join(ctx.env.PREFIX, 'share', 'applications'),
)

View File

@ -144,6 +144,7 @@ def build(ctx):
ctx.set_group(old_grp)
ctx.recurse('noisicaa')
ctx.recurse('misc')
ctx.recurse('data')
if ctx.env.ENABLE_TEST: