A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1#!/usr/bin/env python3
2# -*- coding: utf8 -*-
3# __________ __ ___.
4# Open \______ \ ____ ____ | | _\_ |__ _______ ___
5# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8# \/ \/ \/ \/ \/
9#
10# Copyright © 2010-2011 Rafaël Carré <rafael.carre@gmail>
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation; either version 2
15# of the License, or (at your option) any later version.
16#
17# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18# KIND, either express or implied.
19
20from sys import argv, stderr, stdout
21from subprocess import Popen, PIPE
22from os import execv
23
24args = argv[1:] # remove script path
25
26for opt in ['-E', '-MM', '-v', '--version']:
27 if opt in args:
28 execv(args[0], args) # not actually compiling
29
30if '-o' in args and args.index('-o') < len(args) - 1:
31 if len(args[args.index('-o') + 1].rsplit('.o', 1)) == 1:
32 execv(args[0], args) # output doesn't end in .o
33
34args.append('-mthumb-interwork') # thumb-interwork is required
35gcc = Popen(args + ['-mthumb'], stdout=PIPE, stderr=PIPE)
36(out, err) = gcc.communicate()
37
38if gcc.returncode != 0: # thumb failed, try outputting arm
39 execv(args[0], args)
40
41stdout.write(out.decode("utf-8"))
42stderr.write(err.decode("utf-8"))