Browse Source

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

waf
Ben Niemann 3 years ago
parent
commit
a5ffc00a9b
  1. 24
      build_utils/waf/install.py
  2. BIN
      data/icons/noisicaa-small.png
  3. 1
      data/icons/wscript
  4. 8
      misc/noisicaa
  5. 6
      misc/noisicaa.desktop
  6. 33
      misc/wscript
  7. 1
      wscript

24
build_utils/waf/install.py

@ -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)

BIN
data/icons/noisicaa-small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

1
data/icons/wscript

@ -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

@ -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

@ -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

@ -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'),
)

1
wscript

@ -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:

Loading…
Cancel
Save