forked from cory/tildefriends
		
	Clear up some cruft.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4040 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		
							
								
								
									
										30
									
								
								tools/data
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								tools/data
									
									
									
									
									
								
							| @@ -1,30 +0,0 @@ | |||||||
| #!/usr/bin/python |  | ||||||
|  |  | ||||||
| import os |  | ||||||
| import shutil |  | ||||||
| import subprocess |  | ||||||
| import sys |  | ||||||
| import zipfile |  | ||||||
|  |  | ||||||
| if sys.argv[1] == 'dump': |  | ||||||
| 	with zipfile.ZipFile('data.zip', 'w') as z: |  | ||||||
| 		for root, dirs, files in os.walk('data'): |  | ||||||
| 			for f in files: |  | ||||||
| 				if f == 'data.mdb': |  | ||||||
| 					database = subprocess.check_output(['mdb_dump', root]) |  | ||||||
| 					z.writestr(root, database) |  | ||||||
| elif sys.argv[1] == 'load': |  | ||||||
| 	with zipfile.ZipFile('data.zip', 'r') as z: |  | ||||||
| 		for name in z.namelist(): |  | ||||||
| 			database = z.read(name) |  | ||||||
| 			if os.path.exists(name): |  | ||||||
| 				shutil.rmtree(name) |  | ||||||
| 			os.makedirs(name) |  | ||||||
| 			p = subprocess.Popen(['mdb_load', name], stdin=subprocess.PIPE) |  | ||||||
| 			p.communicate(database) |  | ||||||
| 			assert p.wait() == 0 |  | ||||||
| 		#for root, dirs, files in os.walk('data'): |  | ||||||
| 			#for f in files: |  | ||||||
| 				#if f == 'data.mdb': |  | ||||||
| 					#database = subprocess.check_output(['mdb_dump', root]) |  | ||||||
| 					#z.writestr(root, database) |  | ||||||
| @@ -1,80 +0,0 @@ | |||||||
| #!/usr/bin/python -u |  | ||||||
|  |  | ||||||
| import multiprocessing |  | ||||||
| import os |  | ||||||
| import platform |  | ||||||
| import shutil |  | ||||||
| import stat |  | ||||||
| import subprocess |  | ||||||
| import sys |  | ||||||
|  |  | ||||||
| # Disable buffering. |  | ||||||
| sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) |  | ||||||
|  |  | ||||||
| if len(sys.argv) == 1: |  | ||||||
| 	kWork = os.path.join('deps', sys.platform) |  | ||||||
| elif len(sys.argv) == 2: |  | ||||||
| 	kWork = sys.argv[1] |  | ||||||
|  |  | ||||||
| if not os.path.isdir(kWork): |  | ||||||
| 	os.makedirs(kWork) |  | ||||||
| os.chdir(kWork) |  | ||||||
|  |  | ||||||
| kUvRepository = 'https://github.com/libuv/libuv.git' |  | ||||||
| kUvBranch = 'v1.33.1' |  | ||||||
| kUvWork = 'uv' |  | ||||||
|  |  | ||||||
| cores = multiprocessing.cpu_count() |  | ||||||
| if platform.machine() == 'armv7l': |  | ||||||
| 	cores = 1 |  | ||||||
| print 'Using', cores, 'cores.' |  | ||||||
|  |  | ||||||
| def run(*args, **kw): |  | ||||||
| 	print 'Running:', args |  | ||||||
| 	subprocess.check_call(*args, **kw) |  | ||||||
|  |  | ||||||
| def makeWritableAndRetry(function, path, exc_info): |  | ||||||
| 	if not os.access(path, os.W_OK): |  | ||||||
| 		os.chmod(path, stat.S_IWUSR) |  | ||||||
| 		function(path) |  | ||||||
| 	else: |  | ||||||
| 		raise |  | ||||||
|  |  | ||||||
| def updateUv(): |  | ||||||
| 	print 'libuv' |  | ||||||
| 	print |  | ||||||
| 	clean = False |  | ||||||
|  |  | ||||||
| 	if os.path.exists(os.path.join(kUvWork, '.update-deps-branch')): |  | ||||||
| 		haveBranch = open(os.path.join(kUvWork, '.update-deps-branch'), 'r').read().strip() |  | ||||||
| 		if kUvBranch != haveBranch: |  | ||||||
| 			print haveBranch, '=>', kUvBranch |  | ||||||
| 			clean = True |  | ||||||
| 	else: |  | ||||||
| 		clean = True |  | ||||||
|  |  | ||||||
| 	if clean: |  | ||||||
| 		if os.path.isdir(os.path.join(kUvWork)): |  | ||||||
| 			print 'Cleaning', kUvWork |  | ||||||
| 			shutil.rmtree(os.path.join(kUvWork), onerror=makeWritableAndRetry) |  | ||||||
| 	if not os.path.isdir(kUvWork): |  | ||||||
| 		run(['git', 'clone', '--branch', kUvBranch, kUvRepository, kUvWork]) |  | ||||||
| 	open(os.path.join(kUvWork, '.update-deps-branch'), 'w').write(kUvBranch) |  | ||||||
| 	if sys.platform in ('darwin', 'win32'): |  | ||||||
| 		if not os.path.isdir(os.path.join(kUvWork, 'build', 'gyp')): |  | ||||||
| 			run(['git', 'clone', 'https://chromium.googlesource.com/external/gyp.git', 'build/gyp'], cwd=kUvWork) |  | ||||||
|  |  | ||||||
| 	if sys.platform == 'linux2': |  | ||||||
| 		run(['./gyp_uv.py', '-f', 'make'], cwd=kUvWork) |  | ||||||
| 		run(['make', '-j' + str(cores), '-C', 'out'], cwd=kUvWork) |  | ||||||
| 	elif sys.platform == 'darwin': |  | ||||||
| 		run(['./gyp_uv.py', '-f', 'xcode'], cwd=kUvWork) |  | ||||||
| 		run(['xcodebuild', '-ARCHS="x86_64"', '-project', 'uv.xcodeproj', '-configuration', 'Release', '-target', 'All'], cwd=kUvWork) |  | ||||||
| 	elif sys.platform == 'win32': |  | ||||||
| 		env = os.environ.copy() |  | ||||||
| 		env['VCINSTALLDIR'] = '' |  | ||||||
| 		env['WINDOWSSDKDIR'] = '' |  | ||||||
| 		run(['cmd', '/C', 'call', 'vcbuild.bat', 'release', 'x64'], cwd=kUvWork, env=env) |  | ||||||
|  |  | ||||||
| if __name__ == '__main__': |  | ||||||
| 	updateUv() |  | ||||||
		Reference in New Issue
	
	Block a user