Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add AppVeyor CI setup on Windows #31

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Adapted from https://github.com/bsmurphy/PyKrige/blob/master/appveyor.yml
build: false

environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
matrix:
#- PYTHON_VERSION: 2.7
#- PYTHON_ARCH: "64"
#- MINICONDA: C:\Miniconda-x64
# - PYTHON_VERSION: 3.4
# PYTHON_ARCH: "64"
# MINICONDA: C:\Miniconda3-x64
- PYTHON_VERSION: 3.5
PYTHON_ARCH: "64"
MINICONDA: C:\Miniconda3-x64
- PYTHON_VERSION: 3.6
PYTHON_ARCH: "64"
MINICONDA: C:\Miniconda3-x64

init:
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% %MINICONDA%"

install:
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- "cd C:\\projects\\simhash-py"
# create a conda virtual environement
- "conda create -n simhash-env --yes python=%PYTHON_VERSION%"
- activate simhash-env
- pip install -r requirements.txt
- git submodule update --init --recursive
- python setup.py install



test_script:
- activate simhash-env # activate the virtualenv
- python setup.py build_ext --inplace
- SET PYTHONHASHSEED=0
- nosetests --verbose --nocapture
41 changes: 32 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#! /usr/bin/env python
from __future__ import print_function

from distutils.core import setup
from distutils.extension import Extension
try:
from setuptools.core import setup
from setuptools.extension import Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension

import os

# Complain on 32-bit systems. See README for more details
import struct
Expand All @@ -11,30 +17,46 @@
'Simhash-py does not work on 32-bit systems. See README.md')

ext_files = [
'simhash/simhash-cpp/src/permutation.cpp',
'simhash/simhash-cpp/src/simhash.cpp'
os.path.join('simhash','simhash-cpp', 'src', 'permutation.cpp'),
os.path.join('simhash','simhash-cpp', 'src', 'simhash.cpp')
]

kwargs = {}

print(os.listdir(os.path.join("simhash", "simhash-cpp")))

try:
from Cython.Distutils import build_ext

# Adapt extra_compile_args based on the compiler used
# https://stackoverflow.com/a/5192738/1791279
class build_ext_subclass( build_ext ):
def build_extensions(self):
c = self.compiler.compiler_type
if c == "msvc":
pass # C++ 11 support in Visual Studio should be turned on by default
# and -std=c++11 is not a valid option
else:
for e in self.extensions:
e.extra_compile_args = ['-std=c++11']
build_ext.build_extensions(self)

print('Building from Cython')
ext_files.append('simhash/simhash.pyx')
kwargs['cmdclass'] = {'build_ext': build_ext}
ext_files.append(os.path.join('simhash', 'simhash.pyx'))
kwargs['cmdclass'] = {'build_ext': build_ext_subclass}
except ImportError:
print('Buidling from C++')
ext_files.append('simhash/simhash.cpp')
ext_files.append(os.path.join('simhash','simhash.cpp'))

ext_modules = [
Extension(
'simhash.simhash', ext_files,
language='c++',
extra_compile_args=['-std=c++11'],
include_dirs=['simhash/simhash-cpp/include']
include_dirs=[os.path.join('simhash','simhash-cpp','include')]
)
]


setup(
name='simhash-py',
version='0.4.0',
Expand All @@ -43,6 +65,7 @@
author='Dan Lecocq',
author_email='[email protected]',
classifiers=[

'Programming Language :: Python',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
Expand Down