File: 005-support-python3.patch

package info (click to toggle)
csstidy 1.4-9
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 388 kB
  • sloc: cpp: 2,570; makefile: 5
file content (65 lines) | stat: -rw-r--r-- 2,257 bytes parent folder | download | duplicates (4)
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
Description: Support python3
Makes SConstruct and SConscript python2 and python3 compatible
Author: HÃ¥vard Flaget Aasen <haavard_aasen@yahoo.no>
Last-Update: 2019-12-31
---
--- a/SConstruct
+++ b/SConstruct
@@ -9,22 +9,22 @@
 
 #check if the user has been naughty: only 'debug' or 'release' allowed
 if not (mymode in ['debug', 'release']):
-    print "Error: expected 'debug' or 'release', found: " + mymode
+    print("Error: expected 'debug' or 'release', found: " + mymode)
     Exit(1)
 
 #tell the user what we're doing
-print '**** Compiling in ' + mymode + ' mode...'
+print('**** Compiling in ' + mymode + ' mode...')
 
 debugcflags = ['-Wall', '-g', '-pedantic']   #extra compile flags for debug
 releasecflags = ['-O2']         #extra compile flags for release
 
 env = Environment()
 
-if os.environ.has_key('CPPFLAGS'):
+if 'CPPFLAGS' in os.environ:
     env.Append(CPPFLAGS = SCons.Util.CLVar(os.environ['CPPFLAGS']))
-if os.environ.has_key('CXXFLAGS'):
+if 'CXXFLAGS' in os.environ:
     env.Append(CCFLAGS = SCons.Util.CLVar(os.environ['CXXFLAGS']))
-if os.environ.has_key('LDFLAGS'):
+if 'LDFLAGS' in os.environ:
     env.Append(LINKFLAGS = SCons.Util.CLVar(os.environ['LDFLAGS']))
 
 #make sure the sconscripts can get to the variables
--- a/csstidy/SConscript
+++ b/csstidy/SConscript
@@ -4,7 +4,7 @@
 
 #get all the build variables we need
 Import('env', 'project', 'mymode', 'debugcflags', 'releasecflags')
-localenv = env.Copy()
+localenv = env.Clone()
 
 buildroot = '../' + mymode  #holds the root of the build directory tree
 builddir = buildroot + '/' + project   #holds the build directory for this project
@@ -18,10 +18,10 @@
     localenv.Append(CCFLAGS=releasecflags)
 
 #specify the build directory
-localenv.BuildDir(builddir, ".", duplicate=0)
+localenv.VariantDir(builddir, ".", duplicate=0)
 
 #Figure out all the source files
-srclst = map(lambda x: builddir + '/' + x, sorted(glob.glob('*.cpp')))
+#srclst = map(lambda x: builddir + '/' + x, glob.glob('*.cpp'))
 
 #If running win32 get special version information from the .rc
 if localenv['PLATFORM'] == 'win32':
@@ -29,4 +29,4 @@
     srclst.append(resource)
 
 
-localenv.Program(targetpath, source=srclst)
+localenv.Program(targetpath, sorted(glob.glob('*.cpp')))