mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-26 02:43:43 +03:00
Build psycopg from Python
This commit is contained in:
parent
c875197432
commit
169ce22228
|
@ -82,23 +82,17 @@ init:
|
||||||
|
|
||||||
|
|
||||||
# Repository gets cloned, Cache is restored
|
# Repository gets cloned, Cache is restored
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- "%PYEXE% C:\\appveyor.py install"
|
- "%PYEXE% C:\\appveyor.py install"
|
||||||
|
|
||||||
|
# PostgreSQL server starts now
|
||||||
|
|
||||||
build: off
|
build: off
|
||||||
|
|
||||||
#before_build:
|
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
# Add PostgreSQL binaries to the path
|
- "%PYEXE% C:\\appveyor.py build_script"
|
||||||
- PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%
|
|
||||||
- CD C:\Project
|
|
||||||
- "%PYTHON%\\python.exe setup.py build_ext --have-ssl --pg-config %PGTOP%\\bin\\pg_config.exe -l libpgcommon -l libpgport -L %OPENSSLTOP%\\lib -I %OPENSSLTOP%\\include"
|
|
||||||
- "%PYTHON%\\python.exe setup.py build"
|
|
||||||
- "%PYTHON%\\python.exe setup.py install"
|
|
||||||
- RD /S /Q psycopg2.egg-info
|
|
||||||
|
|
||||||
#after_build:
|
|
||||||
|
|
||||||
before_test:
|
before_test:
|
||||||
# Create and setup PostgreSQL database for the tests
|
# Create and setup PostgreSQL database for the tests
|
||||||
|
|
|
@ -95,14 +95,11 @@ def setup_env():
|
||||||
|
|
||||||
def python_info():
|
def python_info():
|
||||||
logger.info("Python Information")
|
logger.info("Python Information")
|
||||||
out = out_command([py_exe(), '--version'], stderr=sp.STDOUT)
|
run_command([py_exe(), '--version'], stderr=sp.STDOUT)
|
||||||
logger.info("%s", out)
|
run_command(
|
||||||
|
|
||||||
out = out_command(
|
|
||||||
[py_exe(), '-c']
|
[py_exe(), '-c']
|
||||||
+ ["import sys; print('64bit: %s' % (sys.maxsize > 2**32))"]
|
+ ["import sys; print('64bit: %s' % (sys.maxsize > 2**32))"]
|
||||||
)
|
)
|
||||||
logger.info("%s", out)
|
|
||||||
|
|
||||||
|
|
||||||
def step_init():
|
def step_init():
|
||||||
|
@ -131,6 +128,10 @@ def step_install():
|
||||||
build_libpq()
|
build_libpq()
|
||||||
|
|
||||||
|
|
||||||
|
def step_build_script():
|
||||||
|
build_psycopg()
|
||||||
|
|
||||||
|
|
||||||
def build_openssl():
|
def build_openssl():
|
||||||
top = os.path.join(base_dir(), 'openssl')
|
top = os.path.join(base_dir(), 'openssl')
|
||||||
if os.path.exists(os.path.join(top, 'lib', 'libssl.lib')):
|
if os.path.exists(os.path.join(top, 'lib', 'libssl.lib')):
|
||||||
|
@ -284,6 +285,33 @@ $config->{openssl} = "%s";
|
||||||
shutil.rmtree(os.path.join(pgbuild))
|
shutil.rmtree(os.path.join(pgbuild))
|
||||||
|
|
||||||
|
|
||||||
|
def build_psycopg():
|
||||||
|
# Add PostgreSQL binaries to the path
|
||||||
|
setenv(
|
||||||
|
'PATH',
|
||||||
|
os.pathsep.join(
|
||||||
|
[r'C:\Program Files\PostgreSQL\9.6\bin', os.environ['PATH']]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
os.chdir(r"C:\Project")
|
||||||
|
|
||||||
|
# Find the pg_config just built
|
||||||
|
path = os.pathsep.join(
|
||||||
|
[os.path.join(base_dir(), r'postgresql\bin'), os.environ['PATH']]
|
||||||
|
)
|
||||||
|
setenv('PATH', path)
|
||||||
|
|
||||||
|
run_command(
|
||||||
|
[py_exe(), "setup.py", "build_ext", "--have-ssl"]
|
||||||
|
+ ["-l", "libpgcommon", "-l", "libpgport"]
|
||||||
|
+ ["-L", os.path.join(base_dir(), r'openssl\lib')]
|
||||||
|
+ ['-I', os.path.join(base_dir(), r'openssl\include')]
|
||||||
|
)
|
||||||
|
run_command([py_exe(), "setup.py", "build_py"])
|
||||||
|
run_command([py_exe(), "setup.py", "install"])
|
||||||
|
shutil.rmtree("psycopg2.egg-info")
|
||||||
|
|
||||||
|
|
||||||
def download(url, fn):
|
def download(url, fn):
|
||||||
"""Download a file locally"""
|
"""Download a file locally"""
|
||||||
logger.info("downloading %s", url)
|
logger.info("downloading %s", url)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user