convert to python 3

This commit is contained in:
Timothee 'TTimo' Besset 2021-04-25 15:30:41 -05:00
parent 228557dc14
commit 503930527f
7 changed files with 13 additions and 17 deletions

View file

@ -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' )

View file

@ -3,7 +3,7 @@
# TTimo <ttimo@ttimo.net>
# http://scons.org/
from __future__ import print_function
import sys, os, platform, pickle

View file

@ -1,4 +1,4 @@
from __future__ import print_function
import sys, os, traceback, platform, re, subprocess, platform
import urllib3, zipfile, shutil, pprint
@ -318,7 +318,7 @@ class Config:
]:
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
@ -488,7 +488,7 @@ class ConfigParser:
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

View file

@ -1,6 +1,4 @@
#!/usr/bin/env python
from __future__ import print_function
#!/usr/bin/env python3
import os.path, sys, shutil

View file

@ -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')

View file

@ -1,4 +1,4 @@
from __future__ import print_function
import os, time, zipfile, functools, pprint, subprocess
@ -19,13 +19,11 @@ if ( __name__ == '__main__' ):
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

View file

@ -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
@ -106,7 +106,7 @@ def Enum(*names):
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