Finished up converting the source dist install scripts to python. Fixed a couple issues with the other scripts.
This commit is contained in:
parent
9f327fd392
commit
35750681eb
6 changed files with 703 additions and 710 deletions
|
@ -161,9 +161,9 @@ def inject_version(src_file, build=0):
|
|||
pass
|
||||
return match.group(0)
|
||||
|
||||
buf = version_reg.sub(mapname, buf)
|
||||
buf = version_reg.sub(mapname, buf).replace('\r\n', '\n')
|
||||
|
||||
with open(tmp_file, 'w') as fh:
|
||||
with open(tmp_file, 'wb') as fh:
|
||||
fh.write(buf)
|
||||
shutil.move(tmp_file, src_file)
|
||||
|
||||
|
|
|
@ -556,7 +556,7 @@ public class ForgeHooks
|
|||
public static final int majorVersion = 3;
|
||||
public static final int minorVersion = 0;
|
||||
public static final int revisionVersion = 0;
|
||||
public static final int buildVersion = 0;
|
||||
public static final int buildVersion = 5;
|
||||
static
|
||||
{
|
||||
plantGrassList = new ArrayList<ProbableItem>();
|
||||
|
|
|
@ -1,57 +1,3 @@
|
|||
echo off
|
||||
|
||||
echo MinecraftForge Windows Setup Program
|
||||
echo:
|
||||
|
||||
@set PATH=%PATH%;%SystemDir%\system32;%SystemRoot%\System32
|
||||
|
||||
if not exist "..\runtime\bin\fernflower.jar" (
|
||||
..\runtime\bin\python\python_mcp download_fernflower.py
|
||||
)
|
||||
if not exist "..\runtime\bin\fernflower.jar" (
|
||||
echo Failed to download fernflower, install it manually and re-run setup.
|
||||
exit 1
|
||||
)
|
||||
|
||||
pushd .. >nul
|
||||
|
||||
xcopy /Y /E /I forge\conf\* conf
|
||||
|
||||
if exist ".\src" (
|
||||
runtime\bin\python\python_mcp runtime\cleanup.py
|
||||
)
|
||||
if exist ".\src" (
|
||||
echo Please make sure to backup your modified files, and say yes when it asks you to do cleanup.
|
||||
exit 1
|
||||
)
|
||||
runtime\bin\python\python_mcp runtime\decompile.py
|
||||
|
||||
pushd src >nul
|
||||
|
||||
if exist ..\jars\bin\minecraft.jar (
|
||||
for /f "delims=" %%a in ('dir /a -d /b /S ..\forge\patches\minecraft') do (
|
||||
pushd "%%a" 2>nul
|
||||
if errorlevel 1 (
|
||||
..\runtime\bin\python\python_mcp ..\forge\lfcr.py "%%a" "%%a"
|
||||
..\runtime\bin\applydiff.exe -uf -p2 -i "%%a"
|
||||
) else popd
|
||||
)
|
||||
xcopy /Y /E ..\forge\src\minecraft\* minecraft
|
||||
)
|
||||
|
||||
if exist ..\jars\minecraft_server.jar (
|
||||
for /f "delims=" %%a in ('dir /a -d /b /S ..\forge\patches\minecraft_server') do (
|
||||
pushd "%%a" 2>nul
|
||||
if errorlevel 1 (
|
||||
..\runtime\bin\python\python_mcp ..\forge\lfcr.py "%%a" "%%a"
|
||||
..\runtime\bin\applydiff.exe -uf -p2 -i "%%a"
|
||||
) else popd
|
||||
)
|
||||
xcopy /Y /E ..\forge\src\minecraft_server\* minecraft_server
|
||||
)
|
||||
popd >nul
|
||||
|
||||
runtime\bin\python\python_mcp runtime\updatemcp.py -f
|
||||
runtime\bin\python\python_mcp runtime\updatenames.py -f
|
||||
runtime\bin\python\python_mcp runtime\updatemd5.py -f
|
||||
@echo off
|
||||
..\runtime\bin\python\python_mcp install.py
|
||||
pause
|
98
forge/install/install.py
Normal file
98
forge/install/install.py
Normal file
|
@ -0,0 +1,98 @@
|
|||
import os, os.path, sys
|
||||
import urllib, zipfile
|
||||
import shutil, glob, fnmatch
|
||||
import subprocess, logging
|
||||
|
||||
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
mcp_dir = os.path.abspath('..')
|
||||
src_dir = os.path.join(mcp_dir, 'src')
|
||||
|
||||
sys.path.append(mcp_dir)
|
||||
from runtime.decompile import decompile
|
||||
from runtime.updatenames import updatenames
|
||||
from runtime.updatemd5 import updatemd5
|
||||
from runtime.cleanup import cleanup
|
||||
from runtime.updatemcp import updatemcp
|
||||
|
||||
from forge import apply_patches, copytree, reset_logger, download_ff
|
||||
|
||||
def main():
|
||||
print '=================================== Minecraft Forge Setup Start ================================='
|
||||
|
||||
if os.path.isdir(os.path.join(mcp_dir, 'conf')):
|
||||
shutil.rmtree(os.path.join(mcp_dir, 'conf'))
|
||||
copytree(os.path.join(forge_dir, 'conf'), os.path.join(mcp_dir, 'conf'))
|
||||
|
||||
if os.path.isdir(src_dir):
|
||||
os.chdir(mcp_dir)
|
||||
cleanup(None, False)
|
||||
reset_logger()
|
||||
os.chdir(forge_dir)
|
||||
|
||||
if os.path.isdir(src_dir):
|
||||
print 'Please make sure to backup your modified files, and say yes when it asks you to do cleanup.'
|
||||
sys.exit(1)
|
||||
|
||||
if not download_ff(mcp_dir):
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
os.chdir(mcp_dir)
|
||||
# Conf JAD CSV -r -d -a -n -p -o -l -g
|
||||
decompile(None, False, False, True, True, False, True, False, False, False, False)
|
||||
reset_logger()
|
||||
os.chdir(forge_dir)
|
||||
except SystemExit, e:
|
||||
print 'Decompile Exception: %d ' % e.code
|
||||
raise e
|
||||
|
||||
if not os.path.isdir(src_dir):
|
||||
print 'Something went wrong, src folder not found at: %s' % src_dir
|
||||
sys.exit(1)
|
||||
|
||||
has_client = os.path.isdir(os.path.join(mcp_dir, 'src', 'minecraft'))
|
||||
has_server = os.path.isdir(os.path.join(mcp_dir, 'src', 'minecraft_server'))
|
||||
|
||||
fml_dir = os.path.join(forge_dir, 'fml')
|
||||
print 'Applying Forge ModLoader patches'
|
||||
if has_client:
|
||||
if os.path.isdir(os.path.join(fml_dir, 'patches', 'minecraft')):
|
||||
apply_patches(os.path.join(fml_dir, 'patches', 'minecraft'), src_dir)
|
||||
if os.path.isdir(os.path.join(fml_dir, 'src', 'minecraft')):
|
||||
copytree(os.path.join(fml_dir, 'src', 'minecraft'), os.path.join(src_dir, 'minecraft'))
|
||||
if has_server:
|
||||
if os.path.isdir(os.path.join(fml_dir, 'patches', 'minecraft_server')):
|
||||
apply_patches(os.path.join(fml_dir, 'patches', 'minecraft_server'), src_dir)
|
||||
if os.path.isdir(os.path.join(fml_dir, 'src', 'minecraft_server')):
|
||||
copytree(os.path.join(fml_dir, 'src', 'minecraft_server'), os.path.join(src_dir, 'minecraft_server'))
|
||||
|
||||
os.chdir(mcp_dir)
|
||||
updatenames(None, True)
|
||||
reset_logger()
|
||||
os.chdir(forge_dir)
|
||||
|
||||
print 'Applying forge patches'
|
||||
if has_client:
|
||||
if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')):
|
||||
apply_patches(os.path.join(forge_dir, 'patches', 'minecraft'), src_dir)
|
||||
if os.path.isdir(os.path.join(forge_dir, 'src', 'minecraft')):
|
||||
copytree(os.path.join(forge_dir, 'src', 'minecraft'), os.path.join(src_dir, 'minecraft'))
|
||||
if has_server:
|
||||
if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft_server')):
|
||||
apply_patches(os.path.join(forge_dir, 'patches', 'minecraft_server'), src_dir)
|
||||
if os.path.isdir(os.path.join(forge_dir, 'src', 'minecraft_server')):
|
||||
copytree(os.path.join(forge_dir, 'src', 'minecraft_server'), os.path.join(src_dir, 'minecraft_server'))
|
||||
|
||||
os.chdir(mcp_dir)
|
||||
updatemcp(None, True)
|
||||
reset_logger()
|
||||
updatenames(None, True)
|
||||
reset_logger()
|
||||
updatemd5(None, True)
|
||||
reset_logger()
|
||||
os.chdir(forge_dir)
|
||||
|
||||
print '=================================== Minecraft Forge Setup Finished ================================='
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,54 +1,2 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "MinecraftForge Linux Setup Program"
|
||||
echo
|
||||
|
||||
if [ ! -f ../runtime/bin/fernflower.jar ]
|
||||
then
|
||||
python download_fernflower.py
|
||||
fi
|
||||
|
||||
if [ ! -f ../runtime/bin/fernflower.jar ]
|
||||
then
|
||||
echo "Failed to download fernflower, install it manually and re-run setup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd .. > /dev/null
|
||||
|
||||
rm -rf conf
|
||||
mkdir conf
|
||||
cp -r forge/conf/* conf
|
||||
|
||||
./cleanup.sh
|
||||
if [ -d "src" ]
|
||||
then
|
||||
echo "Failed to cleanup the MCP folder, please backup your modified files and run this script again and say yes when promped."
|
||||
exit 1
|
||||
fi
|
||||
./decompile.sh
|
||||
|
||||
pushd src > /dev/null
|
||||
if [ -f ../jars/bin/minecraft.jar ];
|
||||
then
|
||||
for i in `find ../forge/patches/minecraft/ -type f`
|
||||
do
|
||||
patch -p2 -i $i
|
||||
done
|
||||
cp -r ../forge/src/minecraft/* minecraft
|
||||
fi
|
||||
|
||||
|
||||
if [ -f ../jars/minecraft_server.jar ];
|
||||
then
|
||||
for i in `find ../forge/patches/minecraft_server/ -type f`
|
||||
do
|
||||
patch -p2 -i $i
|
||||
done
|
||||
cp -r ../forge/src/minecraft_server/* minecraft_server
|
||||
fi
|
||||
popd > /dev/null
|
||||
|
||||
./updatemcp.sh -f
|
||||
./updatenames.sh -f
|
||||
./updatemd5.sh -f
|
||||
python install.py
|
|
@ -44,16 +44,16 @@ def main():
|
|||
print 'Reobfusicate Exception: %d ' % e.code
|
||||
error_level = e.code
|
||||
|
||||
extract_fml_obfed()
|
||||
version = load_version(build_num)
|
||||
version_str = '%d.%d.%d.%d' % (version['major'], version['minor'], version['revision'], version['build'])
|
||||
|
||||
out_folder = os.path.join(forge_dir, 'forge-%s' % version_str)
|
||||
if os.path.isdir(out_folder):
|
||||
shutil.rmtree(out_folder)
|
||||
|
||||
os.makedirs(out_folder)
|
||||
|
||||
extract_fml_obfed()
|
||||
version = load_version(build_num)
|
||||
version_str = '%d.%d.%d.%d' % (version['major'], version['minor'], version['revision'], version['build'])
|
||||
|
||||
zip_start('minecraftforge-client-%s.zip' % version_str)
|
||||
zip_folder(client_dir, '', zip)
|
||||
zip_add('minecraftforge_credits.txt')
|
||||
|
@ -66,6 +66,7 @@ def main():
|
|||
zip_add('license.txt')
|
||||
zip_end()
|
||||
|
||||
inject_version(os.path.join(forge_dir, 'forge_common', 'net', 'minecraft', 'src', 'forge', 'ForgeHooks.java'), build_num)
|
||||
zip_start('minecraftforge-src-%s.zip' % version_str, 'forge')
|
||||
zip_add('forge_client/src', 'src/minecraft')
|
||||
zip_add('forge_server/src', 'src/minecraft_server')
|
||||
|
@ -80,9 +81,9 @@ def main():
|
|||
zip_add('install/README.txt')
|
||||
zip_add('install/install.py')
|
||||
zip_add('forge.py')
|
||||
zip_add('minecraftforge_credits.txt')
|
||||
zip_add('license.txt')
|
||||
zip_end()
|
||||
inject_version(os.path.join(forge_dir, 'forge_common', 'net', 'minecraft', 'src', 'forge', 'ForgeHooks.java'), 0)
|
||||
|
||||
print '=================================== Release Finished %d =================================' % error_level
|
||||
sys.exit(error_level)
|
||||
|
|
Loading…
Reference in a new issue