diff options
author | David Wilson <dw@botanicus.net> | 2014-04-21 18:52:46 +0100 |
---|---|---|
committer | David Wilson <dw@botanicus.net> | 2014-04-21 18:52:46 +0100 |
commit | bf8e00be5ebf4c254649751dcedc6c95503bf8be (patch) | |
tree | 00f42d38da8f665ec86353ef8a4ff3e9892d4ae0 /misc | |
parent | dde2d33d2477a607bb149b5a0519737d337a063c (diff) |
Win32: initial CI prepare/test scripts.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/windows_build.py | 75 | ||||
-rw-r--r-- | misc/windows_setup.py | 63 |
2 files changed, 138 insertions, 0 deletions
diff --git a/misc/windows_build.py b/misc/windows_build.py new file mode 100644 index 0000000..f66b93d --- /dev/null +++ b/misc/windows_build.py @@ -0,0 +1,75 @@ +# +# Copyright 2014 The py-lmdb authors, all rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted only as authorized by the OpenLDAP +# Public License. +# +# A copy of this license is available in the file LICENSE in the +# top-level directory of the distribution or, alternatively, at +# <http://www.OpenLDAP.org/license.html>. +# +# OpenLDAP is a registered trademark of the OpenLDAP Foundation. +# +# Individual files and/or contributed packages may be copyright by +# other parties and/or subject to additional restrictions. +# +# This work also contains materials derived from public sources. +# +# Additional information about OpenLDAP can be obtained at +# <http://www.openldap.org/>. +# + +from __future__ import absolute_import +import os +import shutil +import subprocess +import tempfile + +INTERPS = ( + ('Python27', False), + ('Python27-64', False), + ('Python31', False), + ('Python31-64', False), + ('Python32', False), + ('Python32-64', False), + ('Python33', False), + ('Python33-64', False), +) + + +def interp_path(interp): + return r'C:\%s\Python' % (interp,) + + +def interp_has_module(path, module): + try: + run(path, '-c', 'import ' + module) + except subprocess.CalledProcessError: + return False + return True + + +def run(*args): + if os.path.exists('build'): + shutil.rmtree('build') + try: + subprocess.check_call(args) + except: + print '!!! COMMAND WAS:', args + raise + + +def main(): + run('git', 'clean', '-dfx', 'dist') + for interp, is_cffi in INTERPS: + path = interp_path(interp) + run('git', 'clean', '-dfx', 'build', 'temp', 'lmdb') + run(path, '-mpip', 'install', '-e', '.') + #run(path, '-mpy.test') + run(path, 'setup.py', 'bdist_egg') + run(path, 'setup.py', 'bdist_wheel') + + +if __name__ == '__main__': + main() diff --git a/misc/windows_setup.py b/misc/windows_setup.py new file mode 100644 index 0000000..c806a0e --- /dev/null +++ b/misc/windows_setup.py @@ -0,0 +1,63 @@ +# +# Copyright 2014 The py-lmdb authors, all rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted only as authorized by the OpenLDAP +# Public License. +# +# A copy of this license is available in the file LICENSE in the +# top-level directory of the distribution or, alternatively, at +# <http://www.OpenLDAP.org/license.html>. +# +# OpenLDAP is a registered trademark of the OpenLDAP Foundation. +# +# Individual files and/or contributed packages may be copyright by +# other parties and/or subject to additional restrictions. +# +# This work also contains materials derived from public sources. +# +# Additional information about OpenLDAP can be obtained at +# <http://www.openldap.org/>. +# + +from __future__ import absolute_import +import os +import urllib + +from windows_build import interp_has_module +from windows_build import interp_path +from windows_build import INTERPS +from windows_build import run + +EZSETUP_URL = ('https://bitbucket.org/pypa/setuptools' + '/raw/bootstrap/ez_setup.py') + + +def ezsetup_path(): + path = os.path.join(os.environ['TEMP'], 'ez_setup.py') + if not os.path.exists(path): + fp = urllib.urlopen(EZSETUP_URL) + with open(path, 'wb') as fp2: + fp2.write(fp.read()) + fp.close() + return path + + +def easy_install_path(interp): + return os.path.join(os.path.dirname(interp), + 'scripts', 'easy_install.exe') + + +def main(): + for interp, is_cffi in INTERPS: + path = interp_path(interp) + if not interp_has_module(path, 'easy_install'): + run(path, ezsetup_path()) + for pkg in 'pip', 'cffi', 'pytest', 'wheel': + modname = 'py.test' if pkg == 'pytest' else pkg + if not interp_has_module(path, modname): + run(easy_install_path(path), pkg) + + +if __name__ == '__main__': + main() |