Skip to content

Commit

Permalink
convert to python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
TTimo committed Apr 25, 2021
1 parent 228557d commit 5039305
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion SConscript.q3map2.urt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def keep_file( n ):
return False
return True

objects += filter( keep_file, [ os.path.join( 'tools/urt/tools/quake3/q3map2', i ) for i in proj.getSourceFiles() ] )
objects += list(filter( keep_file, [ os.path.join( 'tools/urt/tools/quake3/q3map2', i ) for i in proj.getSourceFiles() ] ))
q3map2_urt = env.Program( 'q3map2_urt', objects )

Return( 'q3map2_urt' )
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# TTimo <ttimo@ttimo.net>
# http://scons.org/

from __future__ import print_function


import sys, os, platform, pickle

Expand Down
6 changes: 3 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import print_function


import sys, os, traceback, platform, re, subprocess, platform
import urllib3, zipfile, shutil, pprint
Expand Down Expand Up @@ -318,7 +318,7 @@ def Setup( self ):
]:
if ( not os.path.exists( lib_archive ) ):
print( 'downloading %s' % lib_archive )
archive_web_request = urllib2.urlopen( 'http://s3.amazonaws.com/GtkRadiant/%s' % lib_archive )
archive_web_request = urllib.request.urlopen( 'http://s3.amazonaws.com/GtkRadiant/%s' % lib_archive )
archive_File = open( lib_archive, 'wb' )
while True:
data = archive_web_request.read( 1048576 ) # read 1mb at a time
Expand Down Expand Up @@ -488,7 +488,7 @@ def _parseStatement( self, s ):
value_array.append( value_split.pop() )
value_split.pop()
except:
print( traceback.print_exception( sys.exc_type, sys.exc_value, sys.exc_traceback ) )
print( traceback.print_exception( sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2] ) )
print( 'syntax error (value to array): %s' % ( repr( value_split ) ) )
return

Expand Down
4 changes: 1 addition & 3 deletions install.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import os.path, sys, shutil

Expand Down
2 changes: 1 addition & 1 deletion makeversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def radiant_makeversion(append_about):
f.close()
# aboutmsg
aboutfile = 'include/aboutmsg.default'
if ( os.environ.has_key('RADIANT_ABOUTMSG') ):
if ( 'RADIANT_ABOUTMSG' in os.environ ):
aboutfile = os.environ['RADIANT_ABOUTMSG']
sys.stdout.write("about message is in %s\n" % aboutfile)
f = open(aboutfile, 'r')
Expand Down
10 changes: 4 additions & 6 deletions prepare_archive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import print_function


import os, time, zipfile, functools, pprint, subprocess

Expand All @@ -19,13 +19,11 @@ def write_file( z, prefix_path, folder_name, root, fn ):
for root, dirs, files in os.walk( prefix_path, topdown = True ):
if ( root.find( '.svn' ) >= 0 ):
continue
files = filter(
lambda n : not (
files = [n for n in files if not (
n.endswith( '.lib' )
or n.endswith( '.pdb' )
or n.endswith( '.exp' ) ),
files )
map( functools.partial( write_file, z, prefix_path, folder_name, root ), files )
or n.endswith( '.exp' ) )]
list(map( functools.partial( write_file, z, prefix_path, folder_name, root ), files ))
z.close()

# could be nicer to import s3cmd
Expand Down
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# TTimo <ttimo@ttimo.net>
# http://scons.org/

from __future__ import print_function


import os, subprocess, platform, xml.sax, re, string, platform

Expand Down Expand Up @@ -106,7 +106,7 @@ def __cmp__(self, other):
assert self.EnumType is other.EnumType, "Only values from the same enum are comparable"
return cmp(self.__value, other.__value)
def __invert__(self): return constants[maximum - self.__value]
def __nonzero__(self): return bool(self.__value)
def __bool__(self): return bool(self.__value)
def __repr__(self): return str(names[self.__value])

maximum = len(names) - 1
Expand Down

0 comments on commit 5039305

Please sign in to comment.