mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-10-31 15:57:31 +03:00 
			
		
		
		
	Better dir names in appveyor build
This commit is contained in:
		
							parent
							
								
									637a990e09
								
							
						
					
					
						commit
						285c64d101
					
				|  | @ -172,7 +172,7 @@ def step_build_script(): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def build_openssl(): | def build_openssl(): | ||||||
|     top = base_dir() / 'openssl' |     top = ssl_build_dir() | ||||||
|     if (top / 'lib' / 'libssl.lib').exists(): |     if (top / 'lib' / 'libssl.lib').exists(): | ||||||
|         return |         return | ||||||
| 
 | 
 | ||||||
|  | @ -195,7 +195,7 @@ def build_openssl(): | ||||||
| 
 | 
 | ||||||
|     # Download OpenSSL source |     # Download OpenSSL source | ||||||
|     zipname = f'OpenSSL_{ver}.zip' |     zipname = f'OpenSSL_{ver}.zip' | ||||||
|     zipfile = top_dir() / zipname |     zipfile = cache_dir() / zipname | ||||||
|     if not zipfile.exists(): |     if not zipfile.exists(): | ||||||
|         download( |         download( | ||||||
|             f"https://github.com/openssl/openssl/archive/{zipname}", zipfile |             f"https://github.com/openssl/openssl/archive/{zipname}", zipfile | ||||||
|  | @ -204,7 +204,8 @@ def build_openssl(): | ||||||
|     with ZipFile(zipfile) as z: |     with ZipFile(zipfile) as z: | ||||||
|         z.extractall(path=build_dir()) |         z.extractall(path=build_dir()) | ||||||
| 
 | 
 | ||||||
|     os.chdir(build_dir() / f"openssl-OpenSSL_{ver}") |     sslbuild = build_dir() / f"openssl-OpenSSL_{ver}" | ||||||
|  |     os.chdir(sslbuild) | ||||||
|     run_command( |     run_command( | ||||||
|         ['perl', 'Configure', target, 'no-asm'] |         ['perl', 'Configure', target, 'no-asm'] | ||||||
|         + ['no-shared', 'no-zlib', f'--prefix={top}', f'--openssldir={top}'] |         + ['no-shared', 'no-zlib', f'--prefix={top}', f'--openssldir={top}'] | ||||||
|  | @ -214,12 +215,12 @@ def build_openssl(): | ||||||
| 
 | 
 | ||||||
|     assert (top / 'lib' / 'libssl.lib').exists() |     assert (top / 'lib' / 'libssl.lib').exists() | ||||||
| 
 | 
 | ||||||
|     os.chdir(base_dir()) |     os.chdir(clone_dir()) | ||||||
|     shutil.rmtree(build_dir() / f"openssl-OpenSSL_{ver}") |     shutil.rmtree(sslbuild) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def build_libpq(): | def build_libpq(): | ||||||
|     top = base_dir() / 'postgresql' |     top = pg_build_dir() | ||||||
|     if (top / 'lib' / 'libpq.lib').exists(): |     if (top / 'lib' / 'libpq.lib').exists(): | ||||||
|         return |         return | ||||||
| 
 | 
 | ||||||
|  | @ -234,7 +235,7 @@ def build_libpq(): | ||||||
| 
 | 
 | ||||||
|     # Download PostgreSQL source |     # Download PostgreSQL source | ||||||
|     zipname = f'postgres-REL_{ver}.zip' |     zipname = f'postgres-REL_{ver}.zip' | ||||||
|     zipfile = top_dir() / zipname |     zipfile = cache_dir() / zipname | ||||||
|     if not zipfile.exists(): |     if not zipfile.exists(): | ||||||
|         download( |         download( | ||||||
|             f"https://github.com/postgres/postgres/archive/REL_{ver}.zip", |             f"https://github.com/postgres/postgres/archive/REL_{ver}.zip", | ||||||
|  | @ -271,7 +272,7 @@ $config->{openssl} = "%s"; | ||||||
| 
 | 
 | ||||||
| 1; | 1; | ||||||
| """ | """ | ||||||
|             % str(base_dir() / 'openssl').replace('\\', '\\\\'), |             % str(ssl_build_dir()).replace('\\', '\\\\'), | ||||||
|             file=f, |             file=f, | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|  | @ -314,7 +315,7 @@ $config->{openssl} = "%s"; | ||||||
|     assert (top / 'lib' / 'libpq.lib').exists() |     assert (top / 'lib' / 'libpq.lib').exists() | ||||||
|     assert (top / 'bin' / 'pg_config.exe').exists() |     assert (top / 'bin' / 'pg_config.exe').exists() | ||||||
| 
 | 
 | ||||||
|     os.chdir(base_dir()) |     os.chdir(clone_dir()) | ||||||
|     shutil.rmtree(pgbuild) |     shutil.rmtree(pgbuild) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -325,8 +326,8 @@ def build_psycopg(): | ||||||
|     run_command( |     run_command( | ||||||
|         [py_exe(), "setup.py", "build_ext", "--have-ssl"] |         [py_exe(), "setup.py", "build_ext", "--have-ssl"] | ||||||
|         + ["-l", "libpgcommon", "-l", "libpgport"] |         + ["-l", "libpgcommon", "-l", "libpgport"] | ||||||
|         + ["-L", base_dir() / r'openssl\lib'] |         + ["-L", ssl_build_dir() / 'lib'] | ||||||
|         + ['-I', base_dir() / r'openssl\include'] |         + ['-I', ssl_build_dir() / 'include'] | ||||||
|     ) |     ) | ||||||
|     run_command([py_exe(), "setup.py", "build_py"]) |     run_command([py_exe(), "setup.py", "build_py"]) | ||||||
| 
 | 
 | ||||||
|  | @ -392,7 +393,7 @@ def install_binary_package(): | ||||||
| 
 | 
 | ||||||
| def add_pg_config_path(): | def add_pg_config_path(): | ||||||
|     """Allow finding in the path the pg_config just built.""" |     """Allow finding in the path the pg_config just built.""" | ||||||
|     pg_path = str(base_dir() / r'postgresql\bin') |     pg_path = str(pg_build_dir() / 'bin') | ||||||
|     if pg_path not in os.environ['PATH'].split(os.pathsep): |     if pg_path not in os.environ['PATH'].split(os.pathsep): | ||||||
|         setenv('PATH', os.pathsep.join([pg_path, os.environ['PATH']])) |         setenv('PATH', os.pathsep.join([pg_path, os.environ['PATH']])) | ||||||
| 
 | 
 | ||||||
|  | @ -664,29 +665,37 @@ def clone_dir(): | ||||||
|     return Path(r"C:\Project") |     return Path(r"C:\Project") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def pg_dir(): | def appveyor_pg_dir(): | ||||||
|     return Path(os.environ['POSTGRES_DIR']) |     return Path(os.environ['POSTGRES_DIR']) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def pg_data_dir(): | def pg_data_dir(): | ||||||
|     return pg_dir() / 'data' |     return appveyor_pg_dir() / 'data' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def pg_bin_dir(): | def pg_bin_dir(): | ||||||
|     return pg_dir() / 'bin' |     return appveyor_pg_dir() / 'bin' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def top_dir(): | def pg_build_dir(): | ||||||
|     return Path(r"C:\Others") |     return cache_arch_dir() / 'postgresql' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def base_dir(): | def ssl_build_dir(): | ||||||
|     rv = top_dir() / opt.pyarch / vs_ver() |     return cache_arch_dir() / 'openssl' | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def cache_arch_dir(): | ||||||
|  |     rv = cache_dir() / opt.pyarch / vs_ver() | ||||||
|     return ensure_dir(rv) |     return ensure_dir(rv) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def cache_dir(): | ||||||
|  |     return Path(r"C:\Others") | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def build_dir(): | def build_dir(): | ||||||
|     rv = base_dir() / 'Builds' |     rv = cache_arch_dir() / 'Builds' | ||||||
|     return ensure_dir(rv) |     return ensure_dir(rv) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user