FML will now attempt to download MCP as part of the install process

Now shipping a py2exe version of python for windows.
Linux/Macs should come with python pre-installed so they do not have a distrabution here.
This commit is contained in:
LexManos 2012-12-02 19:59:22 -08:00
parent 5cf07b008e
commit c584d4e3db
6 changed files with 84 additions and 18 deletions

2
fml/.gitignore vendored
View File

@ -8,3 +8,5 @@
fmlbranding.properties
/fernflower.zip
/commands.py.bck
/mcp*.zip
/mcp

View File

@ -46,9 +46,13 @@
<condition property="mcp.home" value="${env.WORKSPACE}/mcpworkspace" else="${default.mcp.home}">
<isset property="env.WORKSPACE" />
</condition>
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
<property name="fml.python.dir" location="${basedir}/python" />
<condition property="python.exe" value="${fml.python.dir}/python_fml" else="python">
<os family="Windows" />
</condition>
<condition property="mcp.exists">
<available file="${mcp.home}/runtime/commands.py"/>
</condition>
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
<property name="mcp.srcdir" location="${mcp.home}/src" />
@ -77,6 +81,13 @@
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
</target>
<target name="makeclean" depends="buildenvsetup" if="mcp.exists">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
</target>
<target name="clean" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
@ -212,6 +223,7 @@
<zipfileset dir="${common.src.dir}" includes="mcpmod.info" prefix="fml/common" />
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
<zipfileset dir="${fml.conf.dir}" prefix="fml/conf" />
<zipfileset dir="${fml.python.dir}" prefix="fml/python" />
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
@ -272,12 +284,8 @@
<antcall target="writeversion"/>
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML-Server and FML-Client projects</echo>
</target>
<target name="fmldecompile" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
<target name="fmldecompile" depends="buildenvsetup,makeclean">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/decompile.py" />
<arg value="${mcp.home}" />
@ -285,11 +293,7 @@
</exec>
</target>
<target name="jenkinsfmldecompile" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
<target name="jenkinsfmldecompile" depends="buildenvsetup,makeclean">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/decompile.py" />
<arg value="${mcp.home}" />

View File

@ -95,8 +95,7 @@ def download_minecraft(mcp_dir, fml_dir, version=None):
default = config_get_section(config, 'default')
if version is None:
version = default['current_ver']
version = default['current_ver']
bin_folder = os.path.join(mcp_dir, 'jars', 'bin')
if not os.path.exists(bin_folder):
@ -615,9 +614,54 @@ def merge_tree(root_src_dir, root_dst_dir):
if os.path.exists(dst_file):
os.remove(dst_file)
shutil.copy(src_file, dst_dir)
def download_mcp(mcp_dir, fml_dir, version=None):
if os.path.isfile(os.path.join(mcp_dir, 'runtime', 'commands.py')):
print 'MCP Detected already, not downloading'
return True
if os.path.isdir(mcp_dir):
print 'Old MCP Directory exists, but MCP was not detected, please delete MCP directory at \'%s\'' % mcp_dir
sys.exit(1)
versions_file = os.path.join(fml_dir, 'mc_versions.cfg')
if not os.path.isfile(versions_file):
print 'Could not find mc_versions.cfg in FML directory.'
sys.exit(1)
config = ConfigParser.ConfigParser()
config.read(versions_file)
default = config_get_section(config, 'default')
if version is None:
version = default['current_ver']
if not config.has_section(version):
print 'Error: Invalid minecraft version, could not find \'%s\' in mc_versions.cfg' % version
sys.exit(1)
mc_info = config_get_section(config, version)
mcp_zip = os.path.join(fml_dir, 'mcp%s.zip' % mc_info['mcp_ver'])
if not download_file(mc_info['mcp_url'], mcp_zip, mc_info['mcp_md5']):
sys.exit(1)
if not os.path.isdir(mcp_dir):
_mkdir(mcp_dir)
print 'Extracting MCP to \'%s\'' % mcp_dir
zf = ZipFile(mcp_zip)
zf.extractall(mcp_dir)
zf.close()
return True
def setup_mcp(fml_dir, mcp_dir, dont_gen_conf=True):
global mcp_version
if not download_mcp(mcp_dir, fml_dir):
sys.exit(1)
backup = os.path.join(mcp_dir, 'runtime', 'commands.py.bck')
runtime = os.path.join(mcp_dir, 'runtime', 'commands.py')
patch = os.path.join(fml_dir, 'commands.patch')

View File

@ -1,4 +1,4 @@
echo off
@set PATH=%PATH%;%SystemDir%\system32;%SystemRoot%\System32;..\runtime\bin\python
python_mcp install.py
@set PATH=%PATH%;%SystemDir%\system32;%SystemRoot%\System32;.\python\
python_fml install.py
pause

View File

@ -1,4 +1,5 @@
import os, os.path, sys
from optparse import OptionParser
from fml import setup_fml, finish_setup_fml, apply_fml_patches, setup_mcp
@ -11,4 +12,15 @@ def fml_main(fml_dir, mcp_dir, dont_gen_conf=True):
print '================ Forge ModLoader Setup End ==================='
if __name__ == '__main__':
fml_main(os.path.dirname(os.path.abspath(__file__)), os.path.abspath('..'))
parser = OptionParser()
parser.add_option('-m', '--mcp-dir', action='store_true', dest='mcp_dir', help='Path to download/extract MCP to', default=None)
options, _ = parser.parse_args()
fml_dir = os.path.dirname(os.path.abspath(__file__))
if not options.mcp_dir is None:
fml_main(fml_dir, os.path.abspath(options.mcp_dir))
if not os.path.isfile(os.path.join('..', 'runtime', 'commands.py')):
fml_main(fml_dir, os.path.abspath('..'))
else:
fml_main(fml_dir, os.path.abspath('mcp'))

View File

@ -10,6 +10,8 @@ server_url = http://assets.minecraft.net/1_4_4/minecraft_server.jar
client_md5 = 7aa46c8058cba2f38e9d2ddddcc77c72
server_md5 = b5feed15df1db87c9aaf78dcefad513d
mcp_ver = 7.21
mcp_url = https://www.dropbox.com/s/dao8itysfwuhj9q/mcp721.zip?dl=1
mcp_md5 = 772ecfdac7e4c9491bfb131cee3bbb36
[1.4.5]
client_url = http://assets.minecraft.net/1_4_5/minecraft.jar
@ -17,3 +19,5 @@ server_url = http://assets.minecraft.net/1_4_5/minecraft_server.jar
client_md5 = b15e2b2b6b4629f0d99a95b6b44412a0
server_md5 = 250654ceae7a26ba955a30095d90a475
mcp_ver = 7.23
mcp_url = https://www.dropbox.com/s/w5vc4kfkge7jti2/mcp723.zip?dl=1
mcp_md5 = 9fbb5835b437b64bc5ce618fa5a53d1d