An open source DAW for GNU/Linux, inspired by modular synths. http://noisicaa.odahoda.de/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

291 lines
8.3 KiB

#!/usr/bin/python3
import argparse
import functools
import operator
import os.path
import subprocess
import sys
import textwrap
def PKG(name, pkg_dist=None, pkg_release=None):
def check(dist, release):
if isinstance(pkg_dist, str) and dist != pkg_dist:
return None
if isinstance(pkg_dist, set) and dist not in pkg_dist:
return None
if isinstance(pkg_release, str):
if pkg_release.startswith('<='):
op = operator.le
check_release = pkg_release[2:]
elif pkg_release.startswith('<'):
op = operator.lt
check_release = pkg_release[1:]
elif pkg_release.startswith('>='):
op = operator.ge
check_release = pkg_release[2:]
elif pkg_release.startswith('>'):
op = operator.gt
check_release = pkg_release[1:]
else:
op = operator.eq
check_release = pkg_release
if not op(release, check_release):
return None
if isinstance(pkg_release, set) and release not in pkg_release:
return None
return name
return check
PIP_DEPS = {
'runtime': [
PKG('./3rdparty/csound/', 'ubuntu', '<17.10'),
PKG('./3rdparty/lv2/', 'ubuntu', '<17.10'),
PKG('./3rdparty/lilv/'),
PKG('./3rdparty/suil/'),
PKG('PyGObject'),
PKG('PyQt5'),
PKG('eventfd'),
PKG('gbulb'),
PKG('numpy'),
PKG('portalocker'),
PKG('posix_ipc'),
PKG('protobuf==3.7.1'),
PKG('psutil'),
PKG('pyaudio'),
PKG('pyparsing'),
PKG('quamash'),
PKG('toposort'),
PKG('urwid'),
],
'build': [
PKG('./3rdparty/protoc/'),
PKG('./3rdparty/faust/'),
PKG('./3rdparty/faustlibraries/'),
PKG('cssutils'),
PKG('cython==0.29.6'),
PKG('pkgconfig'),
PKG('pyyaml'),
# TODO: get my changes upstream and use regular mypy-protobuf package from pip.
PKG('git+https://github.com/odahoda/mypy-protobuf.git#egg=mypy-protobuf&subdirectory=python'),
],
'dev': [
PKG('asynctest'),
PKG('async_generator'),
PKG('coverage'),
PKG('mox3'),
PKG('py-cpuinfo'),
PKG('pyfakefs'),
PKG('pylint==2.3.1'),
PKG('mypy==0.701'),
PKG('mypy-extensions'),
PKG('PyGObject-stubs'),
# For indicator-cpufreq
PKG('dbus-python'),
PKG('bzr+lp:python-distutils-extra#egg=python-distutils-extra'),
PKG('bzr+lp:indicator-cpufreq#egg=indicator-cpufreq'),
],
'vmtests': [
PKG('paramiko'),
PKG('python-xlib'),
],
}
SYS_DEPS = {
'runtime': [
# sf2
PKG('libfluidsynth1'),
PKG('timgm6mb-soundfont'),
PKG('fluid-soundfont-gs'),
PKG('fluid-soundfont-gm'),
# encoding
PKG('ffmpeg'),
PKG('libgoogle-perftools4'),
],
'build': [
# qt4
PKG('libqt4-dev'),
# gtk2
PKG('libgtk2.0-dev'),
PKG('libgirepository1.0-dev'),
# lv2/lilv
PKG('libserd-dev'),
PKG('libsord-dev'),
PKG('libsratom-dev'),
PKG('lv2-dev', 'ubuntu', '>=17.10'),
# ladspa
PKG('ladspa-sdk'),
# sndfile
PKG('libsndfile1-dev'),
# csound
PKG('libsamplerate0-dev', 'ubuntu', '<17.10'),
PKG('libboost-dev', 'ubuntu', '<17.10'),
PKG('flex', 'ubuntu', '<17.10'),
PKG('bison', 'ubuntu', '<17.10'),
PKG('csound', 'ubuntu', '>=17.10'),
PKG('libcsound64-dev', 'ubuntu', '>=17.10'),
# protocol buffers
PKG('autoconf'),
PKG('automake'),
PKG('libtool'),
PKG('curl'),
PKG('make'),
PKG('g++'),
PKG('unzip'),
# libswresample
PKG('libswresample-dev'),
# libavutil
PKG('libavutil-dev'),
# profiling
PKG('libgoogle-perftools-dev'),
# other...
PKG('cmake'),
PKG('python3-dev'),
PKG('portaudio19-dev'),
PKG('libfluidsynth-dev'),
PKG('inkscape'),
PKG('zlib1g-dev'),
PKG('libunwind-dev'),
],
'dev': [
PKG('mda-lv2'),
PKG('swh-plugins'),
PKG('gdb'),
PKG('xvfb'),
PKG('google-perftools'),
# For indicator-cpufreq
PKG('indicator-cpufreq'),
PKG('bzr'),
PKG('intltool'),
],
'vmtests': [
PKG('virtualbox'),
],
}
def list_deps(depdef, dist, release, mode):
# The ordering of the package list is significant, because I can't figure out how to make lv2
# get installed before lilv...
packages = []
if mode == 'runtime':
deps = depdef['runtime']
if mode == 'build':
packages += list_deps(depdef, dist, release, 'runtime')
deps = depdef['build']
if mode == 'dev':
packages += list_deps(depdef, dist, release, 'build')
deps = depdef['dev']
if mode == 'vmtests':
packages += list_deps(depdef, dist, release, 'dev')
deps = depdef['vmtests']
for dep in deps:
pkg = dep(dist, release)
if pkg is not None and pkg not in packages:
packages.append(pkg)
return packages
def pip_deps(dist, release, mode):
return list_deps(PIP_DEPS, dist, release, mode)
def system_deps(dist, release, mode):
return list_deps(SYS_DEPS, dist, release, mode)
def main(argv):
argparser = argparse.ArgumentParser(
description=textwrap.dedent("""\
List the packages that noisicaä depends on.
E.g. to install all dependencies needed to build noisicaä from source:
$ pip install $(./listdeps --pip --build)
$ apt install $(./listdeps --system --build)
"""),
formatter_class=argparse.RawDescriptionHelpFormatter)
argparser.add_argument(
'--pip', action='store_const', const=True, default=False,
help="List python packages (to be installed with e.g. 'pip').")
argparser.add_argument(
'--system', action='store_const', const=True, default=False,
help="List system packages (to be installed with e.g. 'apt').")
argparser.add_argument(
'--runtime', action='store_const', const=True, default=False,
help="List packages needed to run noisicaä.")
argparser.add_argument(
'--build', action='store_const', const=True, default=False,
help="List packages needed to build noisicaä. This includes 'runtime' dependencies.")
argparser.add_argument(
'--dev', action='store_const', const=True, default=False,
help=("List packages needed to develop noisicaä (e.g. run tests). This includes"
" 'runtime' and 'build' dependencies."))
argparser.add_argument(
'--vmtests', action='store_const', const=True, default=False,
help=("List packages needed to run noisidev.runvmtests. This includes"
" 'runtime', 'build' and 'dev' dependencies."))
argparser.add_argument(
'--dist', type=str, default=None,
help=("Select the distribution for which to list packages. By default the distribution"
" is auto'detected."))
args = argparser.parse_args(argv[1:])
if int(args.pip) + int(args.system) != 1:
argparser.error("Exactly one of --pip and --system must be set.")
if int(args.runtime) + int(args.build) + int(args.dev) + int(args.vmtests) != 1:
argparser.error("Exactly one of --runtime, --build, --dev, --vmtests must be set.")
if args.dist is not None:
dist, release = args.dist.split('-', 1)
else:
if os.path.exists('/usr/bin/lsb_release'):
dist, release = subprocess.check_output(
['/usr/bin/lsb_release', '-s', '-i', '-r']).decode('ascii').lower().split('\n', 1)
else:
argparser.error("Can't auto-detect distribution, please set --dist")
if args.vmtests:
mode = 'vmtests'
elif args.dev:
mode = 'dev'
elif args.build:
mode = 'build'
else:
mode = 'runtime'
if args.pip:
print('\n'.join(pip_deps(dist, release, mode)))
elif args.system:
print('\n'.join(system_deps(dist, release, mode)))
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))