commit
aad078e0c9
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,17 +1,18 @@
|
||||
|
||||
# git-ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
||||
|
||||
# Python object code.
|
||||
*.pyc
|
||||
*.pyo
|
||||
*~
|
||||
|
||||
# Vim temporary files.
|
||||
*.sw*
|
||||
|
||||
# Folders created by setup.py.
|
||||
dist
|
||||
build
|
||||
*.egg-info
|
||||
|
||||
# The "standard" virtualenv directory.
|
||||
ENV
|
||||
|
||||
#profiling/outputs
|
||||
mcedit.ini
|
||||
|
63
README.md
Normal file
63
README.md
Normal file
@ -0,0 +1,63 @@
|
||||
# MCEdit
|
||||
|
||||
MCEdit is an open-source, BSD-licenced world editor for the viral indie hit [Minecraft](http://www.minecraft.net/).
|
||||
|
||||
## For Developers
|
||||
|
||||
MCEdit is written in Python using a variety of open source modules. When developing it is recommended to use virtualenv to keep dependencies sane and to easy deployment.
|
||||
|
||||
### Development Quick Guide
|
||||
|
||||
You'll need Python 2.6+ and `easy_install`/`pip` at a minimum before getting started. This quick guide assumes a unix-y OS.
|
||||
|
||||
Clone MCEdit:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/mcdevs/mcedit
|
||||
cd mcedit
|
||||
git submodule init
|
||||
git submodule update
|
||||
```
|
||||
|
||||
Optionally (but highly recommended), setup and activate [virtualenv](http://pypi.python.org/pypi/virtualenv). virtualenv will simplify development by creating an isolated and barebones Python environment. Anything you install while virtualenv is active won't affect your system-wide Python installation, for example.
|
||||
|
||||
```bash
|
||||
easy_install virtualenv
|
||||
virtualenv ENV
|
||||
. ENV/bin/activate
|
||||
```
|
||||
|
||||
Install various dependencies. This may take a bit (especially numpy). If installing pygame errors, try installing from a [binary packages](http://pygame.org/install.html) or following one of the guides from that page to install from source.
|
||||
|
||||
```bash
|
||||
easy_install PyOpenGL
|
||||
easy_install numpy
|
||||
easy_install pygame
|
||||
easy_install pyyaml
|
||||
```
|
||||
|
||||
You should now be able to run MCEdit with `python main.py` assuming you've installed all the dependencies correctly.
|
||||
|
||||
### Freezing/Packaging
|
||||
|
||||
"Freezing" Python applications to deploy them for use by non-technical users is not in any way fun, expect errors and edge cases.
|
||||
|
||||
Additional dependenies are required to package MCEdit. Regardless of which platform you're targetting, [esky](http://pypi.python.org/pypi/esky/) will be required.
|
||||
|
||||
#### OS X
|
||||
*Note:* These instructions have only been testing on OS X Lion.
|
||||
|
||||
You will run into errors attempting to use the system Python when packaging anything under OS X. The easiest way to install a new Python is by using [Homebrew](http://mxcl.github.com/homebrew/).
|
||||
|
||||
If you were using the system python while developing and using virtualenv, you'll need to overwrite it with your newly installed version.
|
||||
|
||||
```bash
|
||||
brew install python
|
||||
virtualenv -p /usr/local/bin/python ENV
|
||||
|
||||
easy_install esky
|
||||
easy_install py2app
|
||||
python setup.py bdist_esky
|
||||
```
|
||||
|
||||
This will leave you with a zip file in `dist/` that contains a portable `.app` bundle.
|
@ -1316,6 +1316,7 @@ if __name__ == "__main__":
|
||||
main()
|
||||
except Exception, e:
|
||||
traceback.print_exc()
|
||||
print "An error has been found! Please send the above to codewarrior0@gmail.com."
|
||||
print("An error occured. Please post the above exception as an issue"
|
||||
"on https://github.com/mcdevs/mcedit/issues/new")
|
||||
raw_input("Press ENTER to dismiss...")
|
||||
|
||||
|
138
setup.py
Normal file
138
setup.py
Normal file
@ -0,0 +1,138 @@
|
||||
from esky import bdist_esky
|
||||
from setuptools import setup
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import platform
|
||||
|
||||
LONG_DESC = '''
|
||||
World / Saved Game Editor for the indie game Minecraft
|
||||
|
||||
Import and export creations from saved games. Brush tools allow modifying
|
||||
terrain on a larger scale. Create, remove, and regenerate chunks in modern
|
||||
'infinite' Minecraft levels.
|
||||
|
||||
Works with saved games from Minecraft Classic, Indev, Infdev, Alpha, Beta,
|
||||
Release, and Pocket Edition.
|
||||
'''
|
||||
|
||||
# setup() options that are common on all platforms.
|
||||
SETUP_COMMON = {
|
||||
# General fields,
|
||||
'name': 'MCEdit',
|
||||
'version': '0.1.1',
|
||||
'description': 'Minecraft World Editor',
|
||||
'long_description': LONG_DESC,
|
||||
|
||||
'author': 'David Vierra',
|
||||
'author_email': 'codewarrior0@gmail.com',
|
||||
|
||||
'maintainer': 'MCDevs',
|
||||
'maintainer_email': 'mcdevs@tkte.ch',
|
||||
|
||||
'url': 'http://www.github.com/mcedit/mcedit',
|
||||
|
||||
# PyPi,
|
||||
'keywords': 'minecraft world editor',
|
||||
'classifiers': [
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
],
|
||||
|
||||
# Building,
|
||||
'packages': [
|
||||
'pymclevel',
|
||||
],
|
||||
'package_data': {
|
||||
'pymclevel': [
|
||||
'*.yaml',
|
||||
'*.txt',
|
||||
'_nbt.*'
|
||||
]
|
||||
},
|
||||
'scripts': [
|
||||
'main.py'
|
||||
]
|
||||
}
|
||||
|
||||
ESKY_OPTIONS = {
|
||||
'bdist_esky': {
|
||||
'includes':[
|
||||
'ctypes',
|
||||
'logging',
|
||||
'OpenGL.arrays.*',
|
||||
'OpenGL.platform',
|
||||
'OpenGL.platform.win32',
|
||||
'encodings'
|
||||
],
|
||||
'excludes':[
|
||||
'Tkconstants',
|
||||
'Tkinter',
|
||||
'tcl',
|
||||
'Cython'
|
||||
],
|
||||
'freezer_options': {
|
||||
'optimize': 2,
|
||||
'compressed': True,
|
||||
'bundle_files': 3,
|
||||
'dll_excludes': [
|
||||
'mswsock.dll',
|
||||
'powrprof.dll'
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def build_nbt():
|
||||
"""
|
||||
Builds _nbt.py.
|
||||
"""
|
||||
os.chdir('pymclevel')
|
||||
os.system(sys.executable + ' setup.py build_ext --inplace --force')
|
||||
os.chdir('..')
|
||||
|
||||
def setup_win32():
|
||||
"""
|
||||
Packing setup for Windows 32/64.
|
||||
"""
|
||||
import py2exe
|
||||
|
||||
# This little ditty makes sure the font module is available
|
||||
origIsSystemDLL = py2exe.build_exe.isSystemDLL
|
||||
def isSystemDLL(pathname):
|
||||
if os.path.basename(pathname).lower() in ['sdl_ttf.dll']:
|
||||
return 0
|
||||
return origIsSystemDLL(pathname)
|
||||
py2exe.build_exe.isSystemDLL = isSystemDLL
|
||||
|
||||
def get_data_files(*args):
|
||||
return [(d, glob.glob(d+'/*')) for d in args]
|
||||
|
||||
def main():
|
||||
build_nbt()
|
||||
if platform.system() == 'Windows':
|
||||
setup_win32()
|
||||
|
||||
data_files = get_data_files('fonts', 'toolicons') + [
|
||||
('', [
|
||||
'history.txt',
|
||||
'README.html',
|
||||
'favicon.png',
|
||||
'terrain-classic.png',
|
||||
'terrain-pocket.png',
|
||||
'char.png',
|
||||
'gui.png',
|
||||
'terrain.png'
|
||||
])
|
||||
]
|
||||
|
||||
setup(
|
||||
data_files=data_files,
|
||||
options=ESKY_OPTIONS,
|
||||
**SETUP_COMMON
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
135
setup_esky.py
135
setup_esky.py
@ -1,135 +0,0 @@
|
||||
"""Copyright (c) 2010-2012 David Rio Vierra
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
|
||||
|
||||
|
||||
from esky import bdist_esky
|
||||
import glob
|
||||
## ...
|
||||
## ModuleFinder can't handle runtime changes to __path__, but win32com uses them
|
||||
#try:
|
||||
# # py2exe 0.6.4 introduced a replacement modulefinder.
|
||||
# # This means we have to add package paths there, not to the built-in
|
||||
# # one. If this new modulefinder gets integrated into Python, then
|
||||
# # we might be able to revert this some day.
|
||||
# # if this doesn't work, try import modulefinder
|
||||
# try:
|
||||
# import py2exe.mf as modulefinder
|
||||
# except ImportError:
|
||||
# import modulefinder
|
||||
# import win32com, sys
|
||||
# for p in win32com.__path__[1:]:
|
||||
# modulefinder.AddPackagePath("win32com", p)
|
||||
# for extra in ["win32com.shell"]: #,"win32com.mapi"
|
||||
# __import__(extra)
|
||||
# m = sys.modules[extra]
|
||||
# for p in m.__path__[1:]:
|
||||
# modulefinder.AddPackagePath(extra, p)
|
||||
#except ImportError:
|
||||
# # no build path setup, no worries.
|
||||
# pass
|
||||
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
# This little ditty makes sure the font module is available
|
||||
import os
|
||||
import py2exe
|
||||
origIsSystemDLL = py2exe.build_exe.isSystemDLL
|
||||
def isSystemDLL(pathname):
|
||||
if os.path.basename(pathname).lower() in ["sdl_ttf.dll"]:
|
||||
return 0
|
||||
return origIsSystemDLL(pathname)
|
||||
py2exe.build_exe.isSystemDLL = isSystemDLL
|
||||
|
||||
build_number = 1
|
||||
|
||||
NAME = "MCEdit"
|
||||
VERSION = "0.1.0r"+str(build_number)
|
||||
DESCRIPTION = "Minecraft World Editor"
|
||||
LONG_DESC = """World / Saved Game Editor for the indie game Minecraft
|
||||
|
||||
Import and export creations from saved games. Brush tools allow modifying terrain
|
||||
on a larger scale. Create, remove, and regenerate chunks in modern "infinite"
|
||||
Minecraft levels.
|
||||
|
||||
Works with saved games from Minecraft Classic, Indev, Infdev, Alpha, Beta, Release, and Pocket Edition.
|
||||
"""
|
||||
AUTHOR = "David Vierra"
|
||||
AUTHOR_EMAIL = "codewarrior0@gmail.com"
|
||||
URL = "http://github.com/mcedit/mcedit"
|
||||
LICENSE = "Creative Commons Attribution;Non-Commercial;No-Derivatives"
|
||||
KEYWORDS = "minecraft world editor"
|
||||
CLASSIFIERS = [
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 2",
|
||||
]
|
||||
|
||||
import platform
|
||||
ARCH = "win32" if platform.architecture()[0] == "32bit" else "win-amd64"
|
||||
|
||||
PACKAGES = ["pymclevel", "pymclevel.yaml"]
|
||||
EXT_MODULES = []
|
||||
PACKAGE_DATA = {"pymclevel":["*.yaml", "*.txt", "_nbt.*"]}
|
||||
|
||||
def get_data_files(*args):
|
||||
return [(d, glob.glob(d+"/*")) for d in args]
|
||||
|
||||
DATA_FILES = get_data_files("fonts", "toolicons") + [
|
||||
("", "history.txt README.html favicon.png terrain-classic.png terrain-pocket.png char.png gui.png terrain.png".split()),
|
||||
]
|
||||
|
||||
ESKY_OPTIONS = {
|
||||
"bdist_esky": {
|
||||
'includes':['ctypes', 'logging', 'OpenGL.arrays.*', 'OpenGL.platform', 'OpenGL.platform.win32', 'encodings'],
|
||||
'excludes':["Tkconstants", "Tkinter", "tcl", "Cython"],
|
||||
"freezer_options": {
|
||||
"optimize":2,
|
||||
"compressed":True,
|
||||
"bundle_files": 3,
|
||||
'dll_excludes': [ "mswsock.dll", "powrprof.dll" ],
|
||||
#"skip_archive":True,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
import logging
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
#build _nbt.pyd
|
||||
os.chdir("pymclevel")
|
||||
os.system(sys.executable + " setup.py build_ext --inplace --force")
|
||||
os.chdir("..")
|
||||
|
||||
setup(name=NAME,
|
||||
version=VERSION,
|
||||
author=AUTHOR,
|
||||
author_email=AUTHOR_EMAIL,
|
||||
url=URL,
|
||||
description=DESCRIPTION,
|
||||
long_description=LONG_DESC,
|
||||
keywords=KEYWORDS,
|
||||
packages=PACKAGES,
|
||||
ext_modules=EXT_MODULES,
|
||||
package_data=PACKAGE_DATA,
|
||||
data_files=DATA_FILES,
|
||||
license=LICENSE,
|
||||
classifiers=CLASSIFIERS,
|
||||
scripts=["main.py"],
|
||||
options=ESKY_OPTIONS,
|
||||
)
|
||||
|
Reference in New Issue
Block a user