-
Notifications
You must be signed in to change notification settings - Fork 1
/
runme.py
75 lines (61 loc) · 2.2 KB
/
runme.py
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
import sys
import os.path
if sys.version_info<(2,6):
print ("Warning: This hasn't been tested with your version of Python. Try Python 2.7.")
if sys.version_info>=(3,0):
print ("Error: This program cannot run in Python 3.0+. Try Python 2.7.")
sys.exit(1)
required_modules = [
('setuptools', False, 'Got to http://pypi.python.org/pypi/setuptools for instructions.', 'This lets you install other Python modules easily.'),
('numpy', True, 'easy_install numpy', 'This performs efficient processing of large arrays of numbers.'),
('PyOpenGL', True, 'easy_install PyOpenGL', 'This allows using a graphics card for rendering.'),
('pygame', True, 'easy_install pygame', 'This creates windows on the screen and manages input.'),
('nbt', True, 'easy_install nbt', 'This parses Minecraft\'s NBT file format.')]
missing_modules = []
try:
import setuptools
except ImportError:
missing_modules.append('setuptools')
try:
import numpy
except ImportError:
missing_modules.append('numpy')
try:
import OpenGL
except ImportError:
missing_modules.append('PyOpenGL')
try:
import pygame
except ImportError:
missing_modules.append('pygame')
try:
import nbt
except ImportError:
missing_modules.append('nbt')
critical_missing_modules = [name for (name, critical, advice, info) in required_modules if name in missing_modules and critical]
if (len(critical_missing_modules)>0):
print ("Some modules are missing. You need to install them first.")
for name, critical, advice, info in required_modules:
if name in missing_modules:
print ("")
print ("I couldn't find '%s'." % name)
print (info)
print ("To install it, try this:")
print (" " + advice)
sys.exit(1)
if not os.path.exists('world/region/r.0.0.mcr'):
print ("Missing file - you need to put r.0.0.mcr in the folder world/region")
sys.exit(1)
if not os.path.exists('terrain.png'):
print ("Missing file - you need to have terrain.png in the current directory.")
import mapfun
del pygame.mixer
mapfun.x()
print "display.quit"
pygame.display.quit()
print "mixer.quit"
#pygame.mixer.quit()
print "pygame.quit"
pygame.quit()
print "end"
sys.exit(0)