1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
From e66f3adc4a941341fbfceb6e078d24c52e8e7c93 Mon Sep 17 00:00:00 2001
From: JP Cimalando <jp-dev@inbox.ru>
Date: Thu, 24 Oct 2019 17:55:57 +0200
Subject: [PATCH] Make the scons build compatible with Python 3
---
SConstruct | 86 +++++++++++++++++++++++++++---------------------------
1 file changed, 43 insertions(+), 43 deletions(-)
diff --git a/SConstruct b/SConstruct
index a46f14b0..d1a6506a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -106,14 +106,14 @@ def main_Aria_func():
elif os.uname()[0] == 'Darwin':
which_os = "macosx"
else:
- print "!! Unknown operating system '" + os.uname()[0] + "', defaulting to Unix"
+ print("!! Unknown operating system '" + os.uname()[0] + "', defaulting to Unix")
which_os = "unix"
if not which_os in ["netbsd", "linux", "macosx", "unix", "windows"]:
- print "!! Unknown operating system '" + which_os + "', please specify 'platform=[linux/macosx/unix/windows/netbsd]'"
+ print("!! Unknown operating system '" + which_os + "', please specify 'platform=[linux/macosx/unix/windows/netbsd]'")
sys.exit(0)
- print">> Operating system : " + which_os
+ print(">> Operating system : " + which_os)
# check what to do
if 'uninstall' in COMMAND_LINE_TARGETS:
@@ -121,7 +121,7 @@ def main_Aria_func():
if which_os in ["linux", "unix", "netbsd"]:
uninstall_Aria_unix()
else:
- print "!! Unknown operation or system (uninstall is not valid on your system)"
+ print("!! Unknown operation or system (uninstall is not valid on your system)")
sys.exit(0)
elif 'install' in COMMAND_LINE_TARGETS:
# install
@@ -130,7 +130,7 @@ def main_Aria_func():
elif which_os == "macosx":
install_Aria_mac()
else:
- print "!! Unknown operation or system (install is not valid on your system)"
+ print("!! Unknown operation or system (install is not valid on your system)")
sys.exit(0)
else:
# compile
@@ -147,10 +147,10 @@ def install_Aria_mac():
sys_command("cp -r ./OSX/*.icns ./Aria\ Maestosa.app/Contents/Resources/.")
sys_command("touch ./Aria\ Maestosa.app")
- print "*** Cleaning up..."
+ print("*** Cleaning up...")
os.system("cd ./Aria\ Maestosa.app && find . -name \".svn\" -exec rm -rf '{}' \;")
- print "*** Done"
+ print("*** Done")
sys.exit(0)
# ---------------------------- Uninstall Linux -----------------------------
@@ -161,10 +161,10 @@ def uninstall_Aria_unix():
prefix = ARGUMENTS.get('prefix', 0)
if prefix == 0:
- print ">> No prefix specified, defaulting to /usr/local/"
+ print(">> No prefix specified, defaulting to /usr/local/")
prefix = '/usr/local/'
else:
- print ">> Prefix: " + prefix
+ print(">> Prefix: " + prefix)
if prefix[-1] != "/":
prefix += "/"
@@ -177,16 +177,16 @@ def uninstall_Aria_unix():
os.system("rm " + app_path)
os.system("rm " + locale_path + "*/LC_MESSAGES/aria_maestosa.mo")
- print "\n*** Uninstall done"
+ print("\n*** Uninstall done")
sys.exit(0)
# -- small helper func
# executes a command on the system shell and prints it to stdout
def sys_command(command):
- print command
+ print(command)
return_status = os.system(command)
if return_status != 0:
- print "An error occured"
+ print("An error occured")
sys.exit(0)
# ---------------------------- Compile -----------------------------
@@ -204,16 +204,16 @@ def compile_Aria(which_os):
env['ENV']['PATH'] = os.environ.get('PATH')
if 'CXX' in os.environ:
- print ">> Using compiler " + os.environ['CXX']
+ print(">> Using compiler " + os.environ['CXX'])
env.Replace(CXX = os.environ['CXX'])
# check build style
build_type = ARGUMENTS.get('config', 'release')
if build_type != 'release' and build_type != 'debug':
- print "!! Unknown build config " + build_type
+ print("!! Unknown build config " + build_type)
sys.exit(0)
- print ">> Build type : " + build_type
+ print(">> Build type : " + build_type)
# check renderer
if which_os == "macosx":
@@ -221,10 +221,10 @@ def compile_Aria(which_os):
else:
renderer = ARGUMENTS.get('renderer', 'wxwidgets')
if renderer != 'opengl' and renderer != 'wxwidgets':
- print "!! Unknown renderer " + renderer
+ print("!! Unknown renderer " + renderer)
sys.exit(0)
- print ">> Renderer : " + renderer
+ print(">> Renderer : " + renderer)
if renderer == 'opengl':
env.Append(CCFLAGS=['-DRENDERER_OPENGL'])
elif renderer == 'wxwidgets':
@@ -233,16 +233,16 @@ def compile_Aria(which_os):
# Check architecture
compiler_arch = ARGUMENTS.get('compiler_arch', platform.architecture(env['CXX']))[0]
if compiler_arch != '32bit' and compiler_arch != '64bit':
- print 'Invalid architecture : ', compiler_arch, '; assuming 32bit'
+ print('Invalid architecture : ', compiler_arch, '; assuming 32bit')
compiler_arch = '32bit'
- print ">> Architecture : " + compiler_arch
+ print(">> Architecture : " + compiler_arch)
# add wxWidgets flags
# check if user defined his own WXCONFIG, else use defaults
WXCONFIG = ARGUMENTS.get('WXCONFIG', 'wx-config')
if which_os != 'windows':
- print ">> wx-config : " + WXCONFIG
+ print(">> wx-config : " + WXCONFIG)
if which_os == 'windows':
@@ -262,12 +262,12 @@ def compile_Aria(which_os):
if renderer == "opengl":
winLdFlags = winLdFlags + ['-lopengl32','-lwxmsw312u_gl_gcc_custom','-lglu32']
- print "Build flags :", winCppFlags
- print "Link flags :", winLdFlags
+ print("Build flags :", winCppFlags)
+ print("Link flags :", winLdFlags)
try:
command = ["windres", "--include-dir="+wxHomePath+"\include", "--input", "win32\Aria.rc", "--output", "msvcr.o"]
- print command
+ print(command)
out = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.PIPE).communicate()
except:
sys.stderr.write("could not execute 'windres', is mingw installed?\n")
@@ -278,8 +278,8 @@ def compile_Aria(which_os):
# Ugly hack : wx flags need to appear at the end of the command, but scons doesn't support that, so I need to hack their link command
env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $SOURCES $_LIBDIRFLAGS $_LIBFLAGS ' + (' -mwindows ' if build_type == 'release' else '') + ' '.join(winLdFlags)
else:
- wxversion = subprocess.check_output([WXCONFIG,"--version"]).strip()
- print ">> wxWidgets version : " + wxversion
+ wxversion = subprocess.check_output([WXCONFIG,"--version"]).decode().strip()
+ print(">> wxWidgets version : " + wxversion)
is_wx_3 = (wxversion[0] == '3' or (wxversion[0] == '2' and wxversion[2] == '9'))
if is_wx_3:
if renderer == "opengl":
@@ -308,16 +308,16 @@ def compile_Aria(which_os):
env.Append(CCFLAGS=['-O2','-DNDEBUG=1'])
else:
- print 'Unknown build type, cannot continue'
+ print('Unknown build type, cannot continue')
sys.exit(0)
# init common header search paths
env.Append(CPPPATH = ['./Src','.','./libjdkmidi/include','./rtmidi'])
- print " "
+ print(" ")
# add common sources
- print "*** Adding source files"
+ print("*** Adding source files")
sources = []
for file in RecursiveGlob(".", "*.cpp"):
@@ -341,7 +341,7 @@ def compile_Aria(which_os):
# OS X (QTKit, CoreAudio, audiotoolbox)
if which_os == "macosx":
- print "*** Adding mac source files and libraries"
+ print("*** Adding mac source files and libraries")
env.Append(CCFLAGS=['-D_MAC_QUICKTIME_COREAUDIO'])
sources = sources + ['Src/Midi/Players/Mac/QuickTimeExport.mm','Src/GUI/Machelper.mm']
env.Append(CPPPATH=['Src/Midi/Players/Mac'])
@@ -365,7 +365,7 @@ def compile_Aria(which_os):
# NetBSD, FreeBSD (Alsa/tiMidity)
elif which_os == "netbsd":
- print "*** Adding Alsa libraries and defines"
+ print("*** Adding Alsa libraries and defines")
if renderer == 'opengl':
env.Append(CCFLAGS=['-DwxUSE_GLCANVAS=1'])
@@ -389,7 +389,7 @@ def compile_Aria(which_os):
# linux (Alsa/tiMidity)
elif which_os == "linux":
- print "*** Adding Alsa libraries and defines"
+ print("*** Adding Alsa libraries and defines")
if renderer == 'opengl':
env.Append(CCFLAGS=['-DwxUSE_GLCANVAS=1'])
@@ -415,7 +415,7 @@ def compile_Aria(which_os):
env.ParseConfig( 'pkg-config --libs glib-2.0' )
elif which_os == "unix":
- print "*** Adding libraries and defines for Unix"
+ print("*** Adding libraries and defines for Unix")
if renderer == 'opengl':
env.Append(CCFLAGS=['-DwxUSE_GLCANVAS=1'])
@@ -436,7 +436,7 @@ def compile_Aria(which_os):
else:
- print "\n\n/!\\ Platform ", which_os, " is unknown"
+ print("\n\n/!\\ Platform ", which_os, " is unknown")
sys.exit(0)
@@ -449,11 +449,11 @@ def compile_Aria(which_os):
# **************************************** COMPILE ********************************************
# *********************************************************************************************
- print " "
- print "====================="
- print " Setup done "
- print "====================="
- print " "
+ print(" ")
+ print("=====================")
+ print(" Setup done ")
+ print("=====================")
+ print(" ")
# compile to .o
object_list = env.Object(source = sources)
@@ -471,14 +471,14 @@ def compile_Aria(which_os):
prefix = ARGUMENTS.get('prefix', 0)
if prefix == 0:
- print ">> No prefix specified, defaulting to /usr/local/"
+ print(">> No prefix specified, defaulting to /usr/local/")
prefix = '/usr/local/'
else:
- print ">> Prefix : " + prefix
+ print(">> Prefix : " + prefix)
# set umask so created directories have the correct permissions
try:
- umask = os.umask(022)
+ umask = os.umask(0o022)
except OSError: # ignore on systems that don't support umask
pass
@@ -495,7 +495,7 @@ def compile_Aria(which_os):
env.Command( executable_target, executable,
[
Copy("$TARGET","$SOURCE"),
- Chmod("$TARGET", 0775),
+ Chmod("$TARGET", 0o0775),
])
@@ -513,7 +513,7 @@ def compile_Aria(which_os):
env.Command( target, source,
[
Copy("$TARGET","$SOURCE"),
- Chmod("$TARGET", 0664),
+ Chmod("$TARGET", 0o0664),
])
# install .mo files
|