Merge branch 'doc' of https://github.com/konstin/stk-code into konstin-doc

This commit is contained in:
hiker 2016-09-21 09:12:32 +10:00
commit ec3dd221a2
16 changed files with 155 additions and 888 deletions

View File

@ -1 +0,0 @@
See the file data/CREDITS .

View File

@ -1,82 +0,0 @@
# SuperTuxKart Installation Instructions
Note: If you obtained this source code from Github, you also need to download
the game assets from Sourceforge using SVN.
`svn checkout https://svn.code.sf.net/p/supertuxkart/code/stk-assets stk-assets`
Place the `stk-assets` folder next to the source root `stk-code` folder.
See <https://supertuxkart.net/Source_control> for more information
## Building STK on Linux
First, make sure that you have the following packages installed:
* OpenGL (mesa)
* OpenAL (recommended: openal-soft-devel)
* Ogg (libogg-dev)
* Vorbis (libvorbis-dev)
* Freetype (libfreetype6-dev)
* libcurl (libcurl-devel)
* libbluetooth (bluez-devel)
* libpng (libpng-devel)
* zlib (zlib-devel)
* jpeg (libjpeg-turbo-devel)
Ubuntu command:
```
sudo apt-get install build-essential cmake libbluetooth-dev \
libcurl4-gnutls-dev libfreetype6-dev libfribidi-dev libgl1-mesa-dev \
libjpeg-dev libogg-dev libopenal-dev libpng-dev libvorbis-dev libxrandr-dev \
mesa-common-dev pkg-config zlib1g-dev
```
Unpack the files from the tarball like this:
```
tar xzf supertuxkart-*.tar.gz
cd supertuxkart-*
```
where `*` is the version of SuperTuxkart you downloaded - eg `0.8.0`. Then:
Compile SuperTuxKart:
```
mkdir cmake_build
cd cmake_build
cmake ..
make VERBOSE=1 -j2
```
To create a debug version of STK, use:
```
cmake .. -DCMAKE_BUILD_TYPE=Debug
```
To test the compilation, supertuxkart can be run from the build
directory by ./bin/supertuxkart
To install the file, as root execute:
```
make install
```
The default install location is `/usr/local`, i.e. the data files will
be written to `/usr/local/share/games/supertuxkart`, the executable
will be copied to `/usr/local/bin`. To change the default installation
location, specify `CMAKE_INSTALL_PREFIX` when running cmake, e.g.:
`cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk`
## Building STK on OS X
See <https://supertuxkart.net/Building_and_packaging_on_OSX>
## Building STK on Windows
See <https://supertuxkart.net/How_to_build_the_Windows_version>

184
README.md
View File

@ -3,13 +3,7 @@
SuperTuxKart is a free kart racing game. It focuses on fun and not on realistic kart physics. Instructions can be found on the in-game help page.
The SuperTuxKart homepage can be found at: <https://supertuxkart.net/>
The official SuperTuxKart forum is at <http://forum.freegamedev.net/viewforum.php?f=16>. If you need support, this would be the best place to start.
Hope you enjoy the game.
-- The SuperTuxKart development team.
The SuperTuxKart homepage can be found at <https://supertuxkart.net/>. There is also our [FAQ](https://supertuxkart.net/FAQ) and information on how get in touch with the [community](https://supertuxkart.net/Community)
## Hardware Requirements
* You need a 3D graphics card. (NVIDIA GeForce 8xxx and higher, ATI Radeon HD 4xxx and higher or Intel HD 3000 and higher.)
@ -18,28 +12,6 @@ Hope you enjoy the game.
* Disk space: 400MB
* Ideally, you want a joystick with at least 6 buttons.
## Compiling SuperTuxKart
### Windows
1. Install VS 2013 (or later). The free express versions work fine.
2. Download and install a source package - either a released package or from our [git/svn repositories](https://supertuxkart.net/Source_control).
3. Download the latest dependency package from [here](https://sourceforge.net/projects/supertuxkart/files/SuperTuxKart%20Dependencies/Windows/). Unzip it in the root directory, so that the dependencies directory is next to the src and data directories (if you are updating from a previous dependency package, you can delete the .dll files in the root directory, they are not needed anymore).
4. Download cmake and install it. Then start cmake-gui and select the STK root directory as 'Where is the source code', and a new directory in the root directory (next to src, data etc) as the build directory (for now I assume that this directory is called bld).
5. Click on configure. You will be asked to create the directory (yes), then for your VS version. Make sure you select the right version (be aware of the easy to confuse version numbers: VS 2013 = version 12). Click on configure, then generate. This will create the directory 'bld', and a VS solution in that directory.
6. In Visual Studio open the project file generated in the 'bld' folder.
7. Right click on the supertuxkart project in the solution explorer, and select "Set as StartUp Project".
8. Select Build->Build Solution (or press F7) to compile.
See <https://supertuxkart.net/How_to_build_the_Windows_version> for more information.
Compilation with cygwin is not officially supported, but this has been done (check with the forum for details).
### Mac OS X
The latest information about compilation on Mac are at our site: <https://supertuxkart.net/Building_and_packaging_on_OSX>
### UNIX
See [`INSTALL.md`](INSTALL.md) for details.
## License
This software is released under the GNU General Public License (GPL) which can be found in the file [`COPYING`](/COPYING) in the same directory as this file. Information about the licenses for artwork are contained in `data/licenses`.
@ -51,3 +23,157 @@ STK : X right, Y up, Z forwards
Blender: X right, Y forwards, Z up
The exporters perform the needed transform, so in Blender you just work with XY plane as ground, and things will appear fine in STK (using XZ as ground in the code, obviously).
## Building from source
First, you need both the code and the assets (See <https://supertuxkart.net/Source_control> for more information):
```
git clone https://github.com/supertuxkart/stk-code
svn checkout https://svn.code.sf.net/p/supertuxkart/code/stk-assets stk-assets
```
## Building on Linux
### Dependencies
Install the following packages:
* OpenGL (mesa)
* OpenAL (recommended: openal-soft-devel)
* Ogg (libogg-dev)
* Vorbis (libvorbis-dev)
* Freetype (libfreetype6-dev)
* libcurl (libcurl-devel)
* libbluetooth (bluez-devel)
* libpng (libpng-devel)
* zlib (zlib-devel)
* jpeg (libjpeg-turbo-devel)
Ubuntu command:
```
sudo apt-get install build-essential cmake libbluetooth-dev \
libcurl4-gnutls-dev libfreetype6-dev libfribidi-dev libgl1-mesa-dev \
libjpeg-dev libogg-dev libopenal-dev libpng-dev libvorbis-dev libxrandr-dev \
mesa-common-dev pkg-config zlib1g-dev
```
### Compiling
Compile SuperTuxKart:
```
mkdir cmake_build
cd cmake_build
cmake ..
make -j4
```
STK can then be run from the build directory with `bin/supertuxkart`
### Further options
To create a debug version of STK, use:
```
cmake .. -DCMAKE_BUILD_TYPE=Debug
```
You can install your build system-wide:
```
sudo make install
```
The default install location is `/usr/local`, i.e. the data files will
be written to `/usr/local/share/games/supertuxkart`, the executable
will be copied to `/usr/local/bin`. To change the default installation
location, specify `CMAKE_INSTALL_PREFIX` when running cmake, e.g.:
`cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk`
## Windows
1. Install VS 2013 (or later). The free express versions work fine.
2. Download and install a source package - either a released package or from our [git/svn repositories](https://supertuxkart.net/Source_control).
3. Download the latest dependency package from [here](https://sourceforge.net/projects/supertuxkart/files/SuperTuxKart%20Dependencies/Windows/). Unzip it in the root directory, so that the dependencies directory is next to the src and data directories (if you are updating from a previous dependency package, you can delete the .dll files in the root directory, they are not needed anymore).
4. Download cmake and install it. Then start cmake-gui and select the STK root directory as 'Where is the source code', and a new directory in the root directory (next to src, data etc) as the build directory (for now I assume that this directory is called bld).
5. Click on configure. You will be asked to create the directory (yes), then for your VS version. Make sure you select the right version (be aware of the easy to confuse version numbers: VS 2013 = version 12). Click on configure, then generate. This will create the directory 'bld', and a VS solution in that directory.
6. In Visual Studio open the project file generated in the 'bld' folder.
7. Right click on the supertuxkart project in the solution explorer, and select "Set as StartUp Project".
8. Select Build->Build Solution (or press F7) to compile.
## OS X
### Getting Started
Install developer tools, either from the OS X Install DVD or from Apple's website.
If you have never built anything before, you have create `/usr/local/include/` first:
```bash
sudo mkdir -p /usr/local/include/
```
Symlink the `include`-folder of OpenGL framework to `/usr/local/include/GL` (Unix programs have an easier time finding it this way):
```bash
sudo ln -s /System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/ /usr/local/include/GL
```
On OS X 10.9.5, you might need the following workaround:
```bash
sudo ln -s `xcrun --show-sdk-path`/usr/include/ /usr/include
sudo ln -s `xcrun --show-sdk-path`/System/Library/Frameworks/OpenGL.framework/Headers/ /usr/local/include/OpenGL
```
The first link is required in order to find libcurl, the second to find opengl.
Download pre-built dependencies from [here](https://sourceforge.net/projects/supertuxkart/files/SuperTuxKart%20Dependencies/OSX/) and put the frameworks in [hard disk root]/Library/Frameworks
### CMake
CMake is used to build STK. At this time CMake will not make a binary that is ready for distribution.
You'll have to run these commands inside your stk-code directory.
### Building
With clang:
```
mkdir cmake_build
cd cmake_build
cmake ..
make
```
With GCC :
```
mkdir cmake_build
cd cmake_build
cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_C_COMPILER=/usr/bin/gcc
make
```
Building on 10.10 with 10.9 compat
```
cmake .. -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
```
### Xcode
Place an additional copy of the dependencies into `Users/<YOUR_USERNAME>/Library/Frameworks`.
Then cd to your cloned stk-code directory and execute the following commands:
```bash
mkdir xcode_build && cd xcode_build
cmake .. -GXcode
```
Use Finder to navigate to your stk-code/xcode_build folder and open the newly generated Xcode project (SuperTuxKart.xcodeproj).
You can then build the project in Xcode using Product -> Build
Note: Xcode is much less well tested than makefiles, so there may be issues when trying to use Xcode.

30
TODO.md
View File

@ -1,30 +0,0 @@
##TODO
SuperTuxKart is looking for additional man power to make this
one of the best free linux games out there :) We need (in
no particular order):
- Musicians/sound engineers
- Create additional background soundtracks
- Create sound effects
- Artists and track designer
- Create additional tracks
- Create additional artwork for tracks and background images
- Developers
- Work on network play support
- Check our bug and enhancement request tracker on
https://github.com/supertuxkart/stk-code/issues
- Extend the current web page and keep it up to date
- Testers
- For just about everything, especially different platforms and graphics cards
- Writers
- Write documentation, ranging from man page, to a description for the web, to a design document, etc...
If you want to help the SuperTuxKart Project, please contact us on the email list: [supertuxkart-devel@lists.sourceforge.net](mailto:supertuxkart-devel@lists.sourceforge.net)
Thanks in advance!
-- The SuperTuxKart Team
For details, see <http://supertuxkart.net/Community>

View File

@ -1,23 +0,0 @@
#!/bin/sh
# Library directory
LIBDIR="bin"
# If we are launching from a symlink, such as /usr/local/bin/run_supertux.sh, we need to get where
# the symlink points to
pth="`readlink $0`"
# $pth will be empty if our start path wasnt a symlink
if [ $pth ]; then
GAMEDIR="`dirname $pth`"
else
GAMEDIR="`dirname $0`"
fi
# Change to the game dir, and go!
cd $GAMEDIR
# export game library directory
test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}"
bin/supertuxkart $*

View File

@ -1,25 +0,0 @@
Here are the guidelines to follow when coding SuperTuxKart:
Filenames
=========
The filenames should be, with underscores between words. Use the .cpp
extension for C++ implementation files and .hpp for C++ headers, .c for
C files and .h for C headers.
Coding style
============
The coding style used in Super Tux Kart can be found at
http://supertuxkart.net/Coding_Style
Documentation line length
=========================
All the documentation files should have at most 80 characters, because
on some displays and on paper you often are limited to 80 characters, and
also under some conditions appendices (for example, line numbers) are
added. The exception if the player's manual, because it's long, so to
understand it better it should be limited to 65 characters.

View File

@ -1,103 +0,0 @@
from matplotlib import pyplot
from os import listdir
def is_numeric(x):
try:
float(x)
except ValueError:
return False
return True
avg_lap_time = {}
avg_pos = {}
avg_speed = {}
avg_top = {}
total_rescued = {}
tests = len(listdir('../../batch'))-1
for file in listdir('../../batch'):
if (file == '.DS_Store'):
continue
f = open('../../batch/'+file,'r')
'''
name_index = file.find('.')
kart_name = str(file[:name_index])
first = file.find('.',name_index+1)
track_name = file[name_index+1:first]
second = file.find('.',first+1)
run = int(file[first+1:second])
'''
track_name = "snowmountain"
kart_names = ["gnu", "sara", "tux", "elephpant"]
if track_name == "snowmountain":
contents = f.readlines()
'''
contents = contents[2:contents.index("[debug ] profile: \n")-1]
content = [s for s in contents if kart_name in s]
data = [float(x) for x in content[0].split() if is_numeric(x)]
if kart_name not in avg_lap_time:
avg_lap_time[kart_name] = []
avg_pos[kart_name] = []
avg_speed[kart_name] = []
avg_top[kart_name] = []
total_rescued[kart_name] = []
avg_lap_time[kart_name].append(data[2]/4)
avg_pos[kart_name].append(data[1])
avg_speed[kart_name].append(data[3])
avg_top[kart_name].append(data[4])
total_rescued[kart_name].append(data[7])
'''
contents = contents[2:6] #TODO check if all is in here
for kart in kart_names:
content = [s for s in contents if kart in s]
data = [float(x) for x in content[0].split() if is_numeric(x)]
if kart not in avg_lap_time:
avg_lap_time[kart] = []
avg_pos[kart] = []
avg_speed[kart] = []
avg_top[kart] = []
total_rescued[kart] = []
avg_lap_time[kart].append(data[2]/4)
avg_pos[kart].append(data[1])
avg_speed[kart].append(data[3])
avg_top[kart].append(data[4])
total_rescued[kart].append(data[7])
tests = len(avg_lap_time["gnu"])
print total_rescued
for kart in kart_names:
print "rescues for ", kart , ": ", sum(total_rescued[kart])/tests
print "avg_lap_time for " , kart , ": " , sum(avg_lap_time[kart])/tests
print "avg_pos for " , kart , ": " , sum(avg_pos[kart])/tests
print "avg_speed for " , kart , ": " , sum(avg_speed[kart])/tests
print "avg_top for " , kart , ": " , sum(avg_top[kart])/tests
pyplot.subplot(2,2,1)
pyplot.plot(list(xrange(tests)),avg_pos["gnu"], "b-")
pyplot.xlabel("tests")
pyplot.ylabel("gnu")
pyplot.subplot(2,2,2)
pyplot.plot(list(xrange(tests)),avg_pos["sara"], "r-")
pyplot.xlabel("tests")
pyplot.ylabel("sara")
pyplot.subplot(2,2,3)
pyplot.plot(list(xrange(tests)),avg_pos["elephpant"], "y-")
pyplot.xlabel("tests")
pyplot.ylabel("elephpant")
pyplot.subplot(2,2,4)
pyplot.plot(list(xrange(tests)),avg_pos["tux"], "g-")
pyplot.xlabel("tests")
pyplot.ylabel("tux")
pyplot.show()

View File

@ -1,3 +0,0 @@
configuration in config.py
To launch, python night.py

View File

@ -1,52 +0,0 @@
#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
# Class used to build the project
################################################################################
from subprocess import check_output
from utils import *
class Build:
"""
Interface for the builder
"""
# if an error occured
__noError = True
#-------------------------------------------------------------------------------
def __init__ (self, buildDir):
"""
Constructor of the builder class
"""
self.__buildDir = buildDir
#-------------------------------------------------------------------------------
def make(self, job):
"""
the make command
"""
changeDir = Cdir(self.__buildDir)
# we try to build supertuxkart
try:
check_output(["make -j" + str(job)], shell=True)
except:
self.__noError = False
del changeDir
#-------------------------------------------------------------------------------
def clean(self):
"""
the clean command
"""
changeDir = Cdir(self.__buildDir)
check_output(["make clean"], shell=True)
del changeDir
#-------------------------------------------------------------------------------
def noError(self):
"""
return true if no error
"""
return self.__noError

View File

@ -1,43 +0,0 @@
#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
# configuration for nightly builder
CONFIG = {
# Directory options
"WORKINGDIR" : "/home/tux/stkalpha/supertuxkart",
"BUILDDIR" : "/home/tux/stkalpha/supertuxkart/cmake_build",
"COMPRESSDIR" : "/home/tux/stkbeta",
"LOGDIR" : "/home/tux/stkalpha",
"SCRIPTDIR" : "/home/tux/stkalpha/nightbuilder",
# directory in the server
"REMOTEDIR" : "/web/public/stknigtly",
# Build options
"JOBMAX" : 3,
# FTP options
"FTPHOST" : "ftp.tux.net",
"FTPUSER" : "tux",
"FTPPASS" : "hell0",
# other
"PLATFORM" : "64",
"OS" : "lin",
"VERSION" : "svn"
}
# arguments by default
# PLEASE Don't edit this section if you don't know what you are doing. Thanks
ARG = {
"BIN" : True,
"DATA" : True,
"CLEAN" : False,
"SEND" : True,
"FORCE" : True,
"UPDATE" : True,
"JOB" : 2,
"HELP" : False
}

View File

@ -1,140 +0,0 @@
#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
################################################################################
# Script used to build nighlies
import os
import sys
import getopt
# import the configuration file
from config import *
# import functions/class
from utils import *
from svn import *
from build import *
from package import *
from send import *
def main():
# error
noBuildErr = False
nosvnErr = False
isBuilt = False
# parse input FIXME The parser doesn't work
#parser(sys.argv[1:])
# welcome message
print
print "nightly builder for supertuxkart"
print "Copyright (C) 2012 Jean-manuel clemencon (samuncle)"
print separator(COLOR.OKBLUE)
# display help
if (ARG["HELP"]):
usage()
print separator(COLOR.OKBLUE)
print
exit()
# svn part -----------------------------------------------------------------
# init the svn
mysvn = Svn(CONFIG["WORKINGDIR"])
print "current svn revision: " + str(mysvn.getLocalRevision())
# Update the svn
if (ARG["UPDATE"]):
space = bufferedOutput("start svn update @ " + getTime())
try:
mysvn.update()
nosvnErr = True
sys.stdout.write(COLOR.OKGREEN + space + "[DONE]" + COLOR.ENDC + "\n")
except:
sys.stdout.write(COLOR.WARNING + 74 * " " + "[FAIL]" + COLOR.ENDC + "\n")
# If no error occured
if (nosvnErr):
print "svn updated rev: " + str(mysvn.getLastRevision())
# buid part ----------------------------------------------------------------
# init the build
mybuild = Build(CONFIG["WORKINGDIR"] + "/cmake_build")
# Clean the project
if (ARG["CLEAN"]):
space = bufferedOutput("start clean @ " + getTime())
try:
mybuild.clean()
sys.stdout.write(COLOR.OKGREEN + space + "[DONE]" + COLOR.ENDC + "\n")
except:
sys.stdout.write(COLOR.WARNING + 74 * " " + "[FAIL]" + COLOR.ENDC + "\n")
# build the project (only if no error and the revision has changed
if (nosvnErr):
if (mysvn.getIsChanged()):
print "revision changed"
space = bufferedOutput("start compilation @ " + getTime())
mybuild.make(ARG["JOB"])
isBuilt = True
if (mybuild.noError()):
noBuildErr = True
sys.stdout.write(COLOR.OKGREEN + space + "[DONE]" + COLOR.ENDC + "\n")
else:
sys.stdout.write(COLOR.WARNING + 74 * " " + "[FAIL]" + COLOR.ENDC + "\n")
else:
print "revsion not changed"
# Build the project (force)
if (ARG["FORCE"] and (not isBuilt) ):
space = bufferedOutput("start forced compilation @ " + getTime())
mybuild.make(ARG["JOB"])
if (mybuild.noError()):
noBuildErr = True
sys.stdout.write(COLOR.OKGREEN + space + "[DONE]" + COLOR.ENDC + "\n")
else:
sys.stdout.write(COLOR.WARNING + 74 * " " + "[FAIL]" + COLOR.ENDC + "\n")
# package part -------------------------------------------------------------
mypack = Package(mysvn.getLastRevision(), CONFIG["COMPRESSDIR"],CONFIG["OS"],CONFIG["PLATFORM"])
# pack the binary
if (noBuildErr and ARG["BIN"]):
space = bufferedOutput("start bin file compress @ " + getTime())
try:
mypack.addFile("supertuxkart", "stkbin", CONFIG["BUILDDIR"] + "/bin")
sys.stdout.write(COLOR.OKGREEN + space + "[DONE]" + COLOR.ENDC + "\n")
except:
sys.stdout.write(COLOR.WARNING + 74 * " " + "[FAIL]" + COLOR.ENDC + "\n")
# pack the data
if(ARG["DATA"]):
space = bufferedOutput("start data file compress @ " + getTime())
try:
mypack.addDir("data", "stkdat", CONFIG["WORKINGDIR"], "*.svn*")
sys.stdout.write(COLOR.OKGREEN + space + "[DONE]" + COLOR.ENDC + "\n")
except:
sys.stdout.write(COLOR.WARNING + 74 * " " + "[FAIL]" + COLOR.ENDC + "\n")
# network part -------------------------------------------------------------
if(ARG["SEND"]):
# send file by FTP
space = bufferedOutput("start file(s) transfer by FTP @ " + getTime())
myFiles = mypack.getFiles()
mysend = Send(CONFIG["FTPHOST"],CONFIG["FTPUSER"],CONFIG["FTPPASS"],CONFIG["SCRIPTDIR"])
for i in myFiles:
mysend.add(i, CONFIG["COMPRESSDIR"], CONFIG["REMOTEDIR"])
#FIXME The ftp didn't throw an exception.
try:
mysend.send()
sys.stdout.write(COLOR.OKGREEN + space + "[DONE]" + COLOR.ENDC + "\n")
except:
sys.stdout.write(COLOR.WARNING + 74 * " " + "[FAIL]" + COLOR.ENDC + "\n")
print separator(COLOR.OKBLUE)
print
if __name__ == "__main__":
main()
#sys.argv[1:]

View File

@ -1,80 +0,0 @@
#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
# Class used to package the project
################################################################################
from subprocess import check_output
from utils import *
class Package:
"""
Interface for the builder
"""
__revision = 0
__listFile = []
#-------------------------------------------------------------------------------
def __init__ (self, revision, compressDir, os,platform):
"""
Constructor of the builder class
"""
self.__os = os
self.__revision = str(revision)
self.__platform = platform
self.__compressDir = compressDir
#-------------------------------------------------------------------------------
def addFile(self, inFile, outFile, workingDir):
"""
Packing a file
"""
# filename
name = outFile \
+ "_" + self.__os \
+ self.__platform \
+ "_" + self.__revision \
+ ".zip"
self.__listFile.append(name)
# prepare the command
command = "zip " \
+ self.__compressDir \
+ "/" + name \
+ " " + inFile
# execute the command to pack the binary
changeDir = Cdir(workingDir)
check_output([command], shell=True)
del changeDir
#-------------------------------------------------------------------------------
def addDir(self, inFile, outFile, workingDir, exclude):
"""
Packing a directory
"""
# filename
name = outFile \
+ "_" + self.__os \
+ "_" + self.__revision \
+ ".zip"
self.__listFile.append(name)
# prepare the command
command = "zip -r --exclude=" \
+ exclude \
+ " " +self.__compressDir \
+ "/" + name \
+ " " + inFile
# execute the command to pack the binary
changeDir = Cdir(workingDir)
check_output([command], shell=True)
del changeDir
#-------------------------------------------------------------------------------
def getFiles(self):
"""
Return the list of file/directory added
"""
return self.__listFile

View File

@ -1,65 +0,0 @@
#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
# Class used to package the project
################################################################################
from subprocess import check_output
import os
from utils import *
class Send:
"""
Interface for the network
"""
def __init__ (self, ftpHost, ftpUser, ftpPass, ftpFileDir):
"""
Constructor of the builder class
"""
# Get the configuration for the FTP connection
lines = [
'FTP_HOST="' + ftpHost + '"\n',
'FTP_USER="' + ftpUser + '"\n',
'FTP_PASS="' + ftpPass + '"\n',
'\n',
'ftp -n -p $FTP_HOST << EOF\n',
'user $FTP_USER $FTP_PASS\n'
]
# open the ftp script
self.__ftpCmd = open("ftp.sh", "w")
self.__ftpCmd.writelines(lines)
self.__ftpFileDir = ftpFileDir
def add(self, filename, localDir, remoteDir):
"""
Add a file to the sender
"""
command = "put " \
+ localDir \
+ "/" + filename \
+ " " + remoteDir \
+ "/" + filename \
+ "\n"
self.__ftpCmd.write(command)
def send(self):
"""
Send files previously added
"""
self.__ftpCmd.write("bye\nEOF\n")
self.__ftpCmd.close()
check_output([self.__ftpFileDir+"/ftp.sh"], shell=True)
#os.system("./ftp.sh")
def alert(self):
"""
Send an e-mail alert to the mailing list
"""
#TODO

View File

@ -1,93 +0,0 @@
#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
# Class for the SVN
################################################################################
import os
from subprocess import check_output
from utils import *
class Svn:
"""
Interface for the SVN
"""
__svnInfoLocal = "" # info of the local repo
__svnInfoLast = "" # info when it's updated
__localRev = 0 # the local revision number
__lastRev = 0 # the updated revision number
__isUp = False # is the repo has been already updated
#-------------------------------------------------------------------------------
def __init__ (self, workingDir):
"""
Constructor of the svn class
"""
# local copy for the configuration
self.__workingDir = workingDir
# cd to the working dir and get info from current revision
changeDir = Cdir(self.__workingDir)
self.__svnInfoLocal = check_output(["svn info"], shell=True)
del changeDir
# exctract the local revision
self.__localRev = self.__parseInfo(self.__svnInfoLocal)
#-------------------------------------------------------------------------------
def __parseInfo(self, strIn):
"""
Parse info to extract the revision
"""
workingData = strIn.split("\n")
for i in workingData:
if "Revision: " in i:
return int(i.split("Revision: ")[1])
#-------------------------------------------------------------------------------
def update(self):
"""
update the repository (svn up)
"""
# cd to the directory and update the svn
changeDir = Cdir(self.__workingDir)
self.__svnInfoLocal = check_output(["svn up"], shell=True)
self.__svnInfoLast = check_output(["svn info"], shell=True)
del changeDir
# exctract the last revision
self.__lastRev = self.__parseInfo(self.__svnInfoLast)
# now we have updated the SVN
self.__isUp = True
#-------------------------------------------------------------------------------
def getLocalRevision(self):
"""
return the local revision
"""
return self.__localRev
#-------------------------------------------------------------------------------
def getLastRevision(self):
"""
return the last revision
"""
if not (self.__isUp):
raise Exception ("The revision has not been updated.")
return self.__lastRev
#-------------------------------------------------------------------------------
def getIsChanged(self):
"""
return true if revision has changed
"""
if not (self.__isUp):
raise Exception ("The revision has not been updated.")
if (self.__lastRev != self.__localRev):
return True
else:
return False

View File

@ -1,100 +0,0 @@
#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
################################################################################
import os
import sys
from time import gmtime, strftime
# import config
from config import *
class Cdir:
"""
A class used to change the directory and reset it when it's destructed
"""
#-------------------------------------------------------------------------------
def __init__ (self, path):
self.oriPath = os.getcwd()
os.chdir(path)
#-------------------------------------------------------------------------------
def __del__ (self):
os.chdir(self.oriPath)
class COLOR:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def separator(color):
return color + 80 * "-" + COLOR.ENDC
#-------------------------------------------------------------------------------
# usage of the script. Displayed if -h is invoqued
def usage(error = ""):
if (error):
print "[error] " + error
h = [
" Options avaliables:",
" --bin # package the binary",
" --data # package the data",
" --clean # remove all packages and logs",
" --send # send the package via FTP",
" --force # force the build (even the revision hasn't changed)",
" --update # update the SVN",
" --web # html output"
" --job= # like -j for make",
" --help # display help",
]
for i in h:
print i
def getTime():
return strftime("%a, %d %b %Y %H:%M:%S GMT+01", gmtime())
#-------------------------------------------------------------------------------
# Used to format output
def bufferedOutput(string, nb = 74):
space = (nb - len(string)) * " "
sys.stdout.write(string)
sys.stdout.flush()
return space
#-------------------------------------------------------------------------------
def parser(argv):
a = os.system("ls")
print a
try:
opts, args = getopt.getopt(argv, "bdcsfuhj:", ["bin",
"data",
"clean",
"send",
"force",
"update",
"help",
"job="
])
for opt, args in opts:
if opt in ("-h", "--help"):
ARG["HELP"] = True
"""
if opt in ("-b", "bin"):
ARG["BIN"] = True
if opt in ("-d", "data"):
ARG["DATA"] = True
if opt in ("-s", "send"):
ARG["SEND"] = True
if opt in ("-f", "force"):
ARG["FORCE"] = True
if opt in ("-u", "update"):
ARG["UPDATE"] = True
"""
except:
usage("unrecognized option")

View File

@ -1,19 +0,0 @@
#!/bin/bash
mkdir -p ../../batch
#tracks='snowmountain city lighthouse olivermath hacienda startrack farm zengarden'
#karts='gnu tux sara elephpant'
laps=4
#for track in $tracks; do
#for kart in $karts; do
for run in {901..1500}; do
for lap in $laps; do
./../cmake_build/bin/supertuxkart.app/Contents/MacOS/supertuxkart -R --mode=3 --numkarts=4 --track=snowmountain --with-profile --profile-laps=4 --kart=gnu --ai=sara,tux,elephpant --no-graphics > /dev/null
#./cmake_build/bin/supertuxkart.app/Contents/MacOS/supertuxkart -R --mode=3 --numkarts=4 --track=$track --with-profile --profile-laps=$lap --kart=$kart --ai=beastie,beastie,beastie --no-graphics > /dev/null
#grep "profile" ~/Library/Application\ Support/SuperTuxKart/stdout.log > ../batch/$kart.$track.$run.txt
grep "profile" ~/Library/Application\ Support/SuperTuxKart/stdout.log > ../../batch/faceoff.$run.txt
done
done
# done
#done