def editFiles(targetDir): files = [] for f in aceutils.get_files(targetDir): basename = os.path.basename(f) ext = os.path.splitext(basename)[1] if ext == '.java': if 'Recorder' in basename: aceutils.rm(f) else: files.append(f) for file in files: ls = [] with open(file, mode='r', encoding='utf-8-sig') as f: for l in f.readlines(): if 'TakeScreenShot' in l: continue if 'CaptureScreen' in l: continue else: ls.append(l) with open(file, mode='w', encoding='utf-8') as f: f.writelines(ls)
def make_webpage(): exclude_ext = [".txt", ".psd", ".BAK", ".pptx"] aceutils.cdToScript() aceutils.cd('../') aceutils.copytree('./Document', './Doc/', True) aceutils.cd('./Doc') img_dir = 'img/' ss_dir = 'img/ss/' files = aceutils.get_files('.') for file in files: if os.path.splitext(file)[1] in exclude_ext: aceutils.rm(file) continue if os.path.splitext(file)[1] != ".md": continue ls = [] # 読み込み with open(file, mode='r', encoding='utf-8-sig') as f: ls = f.readlines() #includeの実装 relPath = '' ls = makeMarkdownUtils.include_basic_sample_web(ls,relPath,ss_dir,'all') ls = makeMarkdownUtils.include_application_sample_web(ls,relPath,ss_dir,'all') # リンクを修正 ls = [s.replace('.md', '.html') for s in ls] ls = [s.replace('\r\n', '\n') for s in ls] # 出力 with open(file, mode='wb') as f: for l in ls: f.write(l.encode('utf-8')) aceutils.mkdir(img_dir) aceutils.mkdir(ss_dir) # SSのコピー for ssfile in makeMarkdownUtils.included_ss_paths: aceutils.copy(ssfile,ss_dir) aceutils.cd('../')
def editFiles(targetDir): files = [] for f in aceutils.get_files(targetDir): basename = os.path.basename(f) ext = os.path.splitext(basename)[1] if ext == '.java': if r'Sample' in basename or 'Program' in basename: aceutils.rm(f) else: files.append(f) for file in files: ls = [] with open(file, mode='r', encoding='utf-8-sig') as f: for l in f.readlines(): l = l.replace(r'public void Run()','public static void main(String args[])') l = l.replace(r'implements ISample','') ls.append(l) with open(file, mode='w', encoding='utf-8-sig') as f: f.writelines(ls)
import aceutils aceutils.cdToScript() aceutils.cd(r'../') aceutils.rm(r'master.zip') aceutils.rmdir(r'Effekseer-master') aceutils.wget(r'https://github.com/effekseer/Effekseer/archive/master.zip') aceutils.unzip(r'master.zip') aceutils.editCmakeForACE(r'Effekseer-master/Dev/Cpp/CMakeLists.txt') aceutils.mkdir(r"effekseer_bin") aceutils.cd(r"effekseer_bin") if aceutils.isWin(): aceutils.call( r'cmake -G "Visual Studio 12" -D USE_MSVC_RUNTIME_LIBRARY_DLL:BOOL=OFF -D USE_INTERNAL_LOADER:BOOL=OFF ../Effekseer-master/Dev/Cpp/' ) aceutils.call( r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" Effekseer.sln /p:configuration=Debug' ) aceutils.call( r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" Effekseer.sln /p:configuration=Release' ) else: aceutils.call( r'cmake -G "Unix Makefiles" -D USE_MSVC_RUNTIME_LIBRARY_DLL:BOOL=OFF -D USE_INTERNAL_LOADER:BOOL=OFF ../Effekseer-master/Dev/Cpp/' ) aceutils.call(r'make')
import aceutils import shutil aceutils.cdToScript() aceutils.cd(r'../') aceutils.rm(r'Box2D_V2.3.0.7z') aceutils.rmdir(r'Box2D_V2.3.0') aceutils.wget(r'https://box2d.googlecode.com/files/Box2D_v2.3.0.7z') if aceutils.isWin(): aceutils.call(r'7za x -y Box2D_v2.3.0.7z') else: aceutils.call(r'7za x -y Box2D_v2.3.0.7z') aceutils.editCmakeForACE(r'Box2D_v2.3.0/Box2D/CMakeLists.txt', 'cp932') aceutils.editCmakeForACE(r'Box2D_v2.3.0/Box2D/Box2D/CMakeLists.txt', 'cp932') aceutils.rmdir(r"box2d_bin") aceutils.rmdir(r"box2d_bin_x64") aceutils.mkdir(r"box2d_bin") aceutils.mkdir(r"box2d_bin_x64") aceutils.cd(r"box2d_bin") if aceutils.isWin(): aceutils.call( r'cmake -G "Visual Studio 12" -D USE_MSVC_RUNTIME_LIBRARY_DLL:BOOL=OFF -D BOX2D_BUILD_EXAMPLES:BOOL=OFF ../Box2D_v2.3.0/Box2D/' ) aceutils.call(
import aceutils pathname = 'glew-1.13.0' aceutils.cdToScript() aceutils.mkdir('../Downloads') with aceutils.CurrentDir('../Downloads'): aceutils.rm(r'glew-1.13.0.zip') aceutils.rmdir(pathname) aceutils.rmdir(r"glew_bin") aceutils.rmdir(r"glew_bin_x64") aceutils.wget(r'https://sourceforge.net/projects/glew/files/glew/1.13.0/glew-1.13.0.zip') aceutils.unzip(r'glew-1.13.0.zip') aceutils.editCmakeForACE(pathname + r'/build/cmake/CMakeLists.txt') aceutils.mkdir(r"glew_bin") aceutils.mkdir(r"glew_bin_x64") with aceutils.CurrentDir('glew_bin'): if aceutils.isWin(): aceutils.call(aceutils.cmd_cmake+r'-UGLEW_USE_STATIC_LIBS ../' + pathname + '/build/cmake') aceutils.call(aceutils.cmd_compile + r'ALL_BUILD.vcxproj /p:configuration=Debug') aceutils.call(aceutils.cmd_compile + r'ALL_BUILD.vcxproj /p:configuration=Release') elif aceutils.isMac(): aceutils.call(r'cmake -G "Unix Makefiles" -UGLEW_USE_STATIC_LIBS -D CMAKE_INSTALL_PREFIX:PATH=../dev "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ../' + pathname + '/build/cmake') aceutils.call(r'make install') else: aceutils.call(r'cmake -G "Unix Makefiles" -UGLEW_USE_STATIC_LIBS -D CMAKE_INSTALL_PREFIX=../dev ../' + pathname + '/build/cmake') aceutils.call(r'make install')
import aceutils zipname = 'master.zip' pathname = 'glfw-master' zipname = 'ed451ea6823380af9ea1ced320182fbcfb176c64.zip' pathname = 'glfw-ed451ea6823380af9ea1ced320182fbcfb176c64' aceutils.cdToScript() aceutils.cd(r'../') aceutils.rm(zipname) aceutils.rmdir(pathname) aceutils.wget(r'https://github.com/altseed/glfw/archive/' + zipname) aceutils.unzip(zipname) aceutils.editCmakeForACE(pathname + r'/CMakeLists.txt') aceutils.rmdir(r"glfw_bin") aceutils.rmdir(r"glfw_bin_x64") aceutils.mkdir(r"glfw_bin") aceutils.mkdir(r"glfw_bin_x64") aceutils.cd(r"glfw_bin") if aceutils.isWin(): aceutils.call( r'cmake -G "Visual Studio 12" -D USE_MSVC_RUNTIME_LIBRARY_DLL:BOOL=OFF -D USE_INTERNAL_LOADER:BOOL=OFF ../' + pathname + '/') aceutils.call(
aceutils.cd(r'libpng_bin') if aceutils.isMac(): aceutils.copy(r'../libpng/scripts/pnglibconf.h.prebuilt', r'../libpng/pnglibconf.h') aceutils.call( r'cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -D PNG_STATIC:BOOL=ON -D CMAKE_INSTALL_PREFIX:PATH=../../Dev "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ../libpng/' ) else: aceutils.call( r'cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS:BOOL=OFF -D CMAKE_INSTALL_PREFIX:PATH=../../Dev ../libpng/' ) aceutils.call(r'make install') aceutils.cd(r'../../') aceutils.rm(r'Dev/lib/libz.so') aceutils.rm(r'Dev/lib/libz.so.1') aceutils.rm(r'Dev/lib/libz.so.1.2.8') aceutils.rm(r'Dev/lib/libpng.so') aceutils.rm(r'Dev/lib/libpng16.so') aceutils.rm(r'Dev/lib/libpng16.so.16') aceutils.rm(r'Dev/lib/libpng16.so.16.6.0') aceutils.rm(r'Dev/lib/libz.dylib') aceutils.rm(r'Dev/lib/libz.1.dylib') aceutils.rm(r'Dev/lib/libz.1.2.8.dylib') aceutils.rm(r'Dev/lib/libpng.dylib') aceutils.rm(r'Dev/lib/libpng16.dylib') aceutils.rm(r'Dev/lib/libpng16.16.dylib')
import aceutils pathname = 'glfw' aceutils.cdToScript() aceutils.mkdir('../Downloads') aceutils.mkdir('../Temp') aceutils.mkdir(r"../include/") aceutils.mkdir(r"../lib/") with aceutils.CurrentDir('../Temp'): # Copy from submodule aceutils.copytree('../Downloads/glfw/', './glfw/', True) aceutils.rm('./glfw/.git') aceutils.rmdir('./glfw/.github/') # Compile aceutils.rmdir(r"glfw_bin") aceutils.rmdir(r"glfw_bin_x64") aceutils.editCmakeForACE(pathname + r'/CMakeLists.txt') aceutils.mkdir(r"glfw_bin") aceutils.mkdir(r"glfw_bin_x64") with aceutils.CurrentDir('glfw_bin'): if aceutils.isWin(): aceutils.call( aceutils.cmd_cmake + r'-D USE_MSVC_RUNTIME_LIBRARY_DLL:BOOL=OFF -D GLFW_BUILD_EXAMPLES:BOOL=OFF -D GLFW_BUILD_TESTS:BOOL=OFF ../'
import aceutils aceutils.cdToScript() aceutils.cd(r'../') aceutils.rm(r'bullet-2.82-r2704.zip') aceutils.rmdir(r'bullet-2.82-r2704') aceutils.wget(r'https://bullet.googlecode.com/files/bullet-2.82-r2704.zip') aceutils.unzip(r'bullet-2.82-r2704.zip') aceutils.editCmakeForACE(r'bullet-2.82-r2704/CMakeLists.txt', 'cp932') aceutils.rmdir(r"bullet_bin") aceutils.rmdir(r"bullet_bin_x64") aceutils.mkdir(r"bullet_bin") aceutils.mkdir(r"bullet_bin_x64") aceutils.cd(r"bullet_bin") if aceutils.isWin(): aceutils.call( r'cmake -G "Visual Studio 12" -D USE_MSVC_RUNTIME_LIBRARY_DLL:BOOL=OFF -D BUILD_DEMOS:BOOL=OFF ../bullet-2.82-r2704/' ) aceutils.call( r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" BULLET_PHYSICS.sln /p:configuration=Debug' ) aceutils.call( r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" BULLET_PHYSICS.sln /p:configuration=Release' )
aceutils.editCmakeForACE(r'libpng-1.6.6/CMakeLists.txt') aceutils.mkdir(r'zlib_bin') aceutils.mkdir(r'libpng_bin') if aceutils.isWin(): print('already installed.') else: aceutils.cd(r'zlib_bin') aceutils.call( r'cmake -G "Unix Makefiles" -D BUILD_SHARED_LIBS:BOOL=OFF -D CMAKE_INSTALL_PREFIX=../Dev ../zlib-1.2.8/' ) aceutils.call(r'make install') aceutils.cd(r'../') aceutils.cd(r'libpng_bin') aceutils.call( r'cmake -G "Unix Makefiles" -D BUILD_SHARED_LIBS:BOOL=OFF -D CMAKE_INSTALL_PREFIX=../Dev ../libpng-1.6.6/' ) aceutils.call(r'make install') aceutils.cd(r'../') aceutils.rm(r'Dev/lib/libz.so') aceutils.rm(r'Dev/lib/libz.so.1') aceutils.rm(r'Dev/lib/libz.so.1.2.8') aceutils.rm(r'Dev/lib/libpng.so') aceutils.rm(r'Dev/lib/libpng16.so') aceutils.rm(r'Dev/lib/libpng16.so.16') aceutils.rm(r'Dev/lib/libpng16.so.16.6.0')
aceutils.cd(r'libpng_bin') if aceutils.isMac(): aceutils.copy(r'../libpng/scripts/pnglibconf.h.prebuilt', r'../libpng/pnglibconf.h') aceutils.call( r'cmake -G "Unix Makefiles" -D PNG_STATIC:BOOL=ON -D CMAKE_INSTALL_PREFIX=../dev "-DCMAKE_OSX_ARCHITECTURES=x86_64' + (';i386' if aceutils.Isi386() else '') + r'" ../libpng/') else: aceutils.call( r'cmake -G "Unix Makefiles" -D BUILD_SHARED_LIBS:BOOL=OFF -D CMAKE_INSTALL_PREFIX=../dev ../libpng/' ) aceutils.call(r'make install') aceutils.cd(r'../') aceutils.rm(r'dev/lib/libz.so') aceutils.rm(r'dev/lib/libz.so.1') aceutils.rm(r'dev/lib/libz.so.1.2.11') aceutils.rm(r'dev/lib/libpng.so') aceutils.rm(r'dev/lib/libpng16.so') aceutils.rm(r'dev/lib/libpng16.so.16') aceutils.rm(r'dev/lib/libpng16.so.16.21.0') aceutils.rm(r'dev/lib/libz.dylib') aceutils.rm(r'dev/lib/libz.1.dylib') aceutils.rm(r'dev/lib/libz.1.2.11.dylib') aceutils.rm(r'dev/lib/libpng.dylib') aceutils.rm(r'dev/lib/libpng16.dylib') aceutils.rm(r'dev/lib/libpng16.16.dylib')
import aceutils aceutils.cdToScript() aceutils.cd(r'../') aceutils.rm(r'gd-2.1.1.zip') aceutils.rmdir(r'libgd-gd-2.1.1') aceutils.wget(r'https://github.com/libgd/libgd/archive/gd-2.1.1.zip') aceutils.unzip(r'gd-2.1.1.zip') aceutils.rmdir(r"gd_bin") aceutils.rmdir(r"gd_bin_x64") aceutils.mkdir(r"gd_bin") aceutils.mkdir(r"gd_bin_x64") aceutils.editCmakeForACE(r'libgd-gd-2.1.1/CMakeLists.txt','cp932') aceutils.editCmakeForACE(r'libgd-gd-2.1.1/src/CMakeLists.txt','cp932') aceutils.cd(r"gd_bin") if aceutils.isWin(): aceutils.call(r'cmake -G "Visual Studio 12" ../libgd-gd-2.1.1/') aceutils.call(r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" src/libgd_static.vcxproj /p:configuration=Debug') aceutils.call(r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" src/libgd_static.vcxproj /p:configuration=Release') elif aceutils.isMac(): aceutils.call(r'cmake -G "Unix Makefiles" "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ../libgd-gd-2.1.1/') aceutils.call(r'make') else: aceutils.call(r'cmake -G "Unix Makefiles" ../libgd-gd-2.1.1/')
import aceutils aceutils.cdToScript() aceutils.cd(r'../') aceutils.rm(r'ft26.zip') aceutils.rmdir(r'freetype-2.6') aceutils.wget(r'http://sourceforge.net/projects/freetype/files/freetype2/2.6/ft26.zip') aceutils.unzip(r'ft26.zip') aceutils.rmdir(r"freetype_bin") aceutils.rmdir(r"freetype_bin_x64") aceutils.mkdir(r"freetype_bin") aceutils.mkdir(r"freetype_bin_x64") aceutils.editCmakeForACE(r'freetype-2.6/CMakeLists.txt','cp932') aceutils.cd(r"freetype_bin") if aceutils.isWin(): aceutils.call(r'cmake -G "Visual Studio 12" ../freetype-2.6/') aceutils.call(r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" freetype.sln /p:configuration=Debug') aceutils.call(r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" freetype.sln /p:configuration=Release') elif aceutils.isMac(): aceutils.call(r'cmake -G "Unix Makefiles" "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ../freetype-2.6/') aceutils.call(r'make') else: aceutils.call(r'cmake -G "Unix Makefiles" ../freetype-2.6/') aceutils.call(r'make')
def make_document_html(mode): exclude_ext = [".txt", ".psd", ".BAK", ".pptx"] template="""<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <STYLE type="text/css"> <!-- @charset "utf-8"; body { line-height: 1.5em; } *::selection { background-color: rgba(255, 210, 130, 0.5); /* background-color: rgba(160, 220, 150, 0.5);*/ } h1, h2, h3, h4 { font-family: "Meiryo UI"; display: block; } h1, h2, h3 { padding: 0.2em 0.3em; } h1 { font-size: 2em; background-color: #ddeeee; border-bottom: 1px solid #999999; line-height: 1.2em; } h2 { font-size: 1.5em; background-color: #eef3f3; border-bottom: 1px solid #999999; line-height: 1.2em; } h3{ font-size: 1.3em; background-color: #eeeeee; } h4 { font-size: 1.1em; margin-top: 0.3em; margin-bottom: 0em; } p { margin-bottom: 0.9em; } p code { border: 1px solid #ccc; border-radius: 3px; background-color: #f9f9f9; padding: 1px 5px; display: inline-block; } pre { margin-top: 0.1em; margin-left: 1em; border: 1px solid #ccc; background-color: #f9f9f9; padding: 3px 5px; display: block; font: 1em "Consolas"; } pre code { font: 0.9em "Consolas"; } code { color: #52595d; font: 0.95em "Consolas"; margin: 0em 0.3em; } hr { border: 0; border-bottom: 2px dashed #acc; background-color: #fff; } ul { list-style-type: none; } li { border-left: 2px solid #cdd; margin-bottom: 2px; padding-left: 0.5em; } em { display: none; } table { border-collapse: collapse; } td, th { border: 1px solid #8bb; padding: 2px 5px; vertical-align: middle; } --> </STYLE> <title>$title$</title> </head> <body> $body$ </body> </html> """ aceutils.cdToScript() aceutils.cd('../') aceutils.copytree('./Document', './DocumentHtml', True) aceutils.cd('./DocumentHtml') img_dir = 'img/' ss_dir = 'img/ss/' files = aceutils.get_files('.') with open('template.html', mode='w', encoding='utf-8') as f: f.write(template) for file in files: if os.path.splitext(file)[1] in exclude_ext: aceutils.rm(file) continue if os.path.splitext(file)[1] != ".md": continue ls = [] # 読み込み with open(file, mode='r', encoding='utf-8') as f: ls = f.readlines() #includeの実装 relPath = file ls = makeMarkdownUtils.include_basic_sample(ls,relPath,ss_dir,mode) ls = makeMarkdownUtils.include_application_sample(ls,relPath,ss_dir,mode) # リンクを修正 ls = [s.replace('.md', '.html') for s in ls] # 出力 with open(file, mode='w', encoding='utf-8') as f: f.writelines(ls) # pandocによる出力 aceutils.call('pandoc -f markdown_github -t html5 -s --template=template.html -o {0}.html {0}.md'.format(os.path.splitext(file)[0])) aceutils.rm(file) aceutils.mkdir(img_dir) aceutils.mkdir(ss_dir) # SSのコピー for ssfile in makeMarkdownUtils.included_ss_paths: aceutils.copy(ssfile,ss_dir) aceutils.rm('template.html') aceutils.cd('../')
import aceutils aceutils.cdToScript() aceutils.cd(r"../") aceutils.rm(r"gtest-1.7.0.zip") aceutils.rmdir(r"gtest-1.7.0") aceutils.wget(r"http://googletest.googlecode.com/files/gtest-1.7.0.zip") aceutils.unzip(r"gtest-1.7.0.zip") aceutils.rmdir(r"gtest_bin") aceutils.rmdir(r"gtest_bin_x64") aceutils.mkdir(r"gtest_bin") aceutils.mkdir(r"gtest_bin_x64") aceutils.cd(r"gtest_bin") if aceutils.isWin(): aceutils.call( r'cmake -G "Visual Studio 12" -D BUILD_SHARED_LIBS:BOOL=OFF ../gtest-1.7.0/' ) aceutils.call( r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" gtest.sln /p:configuration=Debug' ) aceutils.call( r'"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild" gtest.sln /p:configuration=Release' )