From bf4c5751c119f65160c6a7b8021cee67c0a2ad27 Mon Sep 17 00:00:00 2001 From: Reece Heineke Date: Sun, 9 Oct 2016 20:04:11 -0400 Subject: [PATCH 1/3] Python 2 and 3 support --- quickfix-python/setup.py | 46 ++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/quickfix-python/setup.py b/quickfix-python/setup.py index 853da37..a7de2cb 100644 --- a/quickfix-python/setup.py +++ b/quickfix-python/setup.py @@ -1,41 +1,51 @@ +from __future__ import print_function + from distutils.core import setup from distutils.core import Extension -from distutils.command.install import install -from distutils.command.build import build from distutils.command.build_ext import build_ext -import subprocess -import shutil import glob -import os + class build_ext_subclass( build_ext ): def build_extensions(self): - print "Testing for std::tr1::shared_ptr..." + print("Testing for std::tr1::shared_ptr...") try: self.compiler.compile(['test_std_tr1_shared_ptr.cpp']) self.compiler.define_macro("HAVE_STD_TR1_SHARED_PTR") - print "...found" + print("...found") except: - print " ...not found" + print(" ...not found") - print "Testing for std::shared_ptr..." + print("Testing for std::shared_ptr...") try: - self.compiler.compile(['test_std_shared_ptr.cpp'], extra_preargs=['-std=c++0x']), + self.compiler.compile(['test_std_shared_ptr.cpp'], + extra_preargs=['-std=c++0x']), self.compiler.define_macro("HAVE_STD_SHARED_PTR") - print "...found" + print("...found") except: - print "...not found" + print("...not found") build_ext.build_extensions(self) -long_description='' +long_description = '' with open('LICENSE') as file: license = file.read(); setup(name='quickfix', version='1.14.3', - py_modules=['quickfix', 'quickfixt11', 'quickfix40', 'quickfix41', 'quickfix42', 'quickfix43', 'quickfix44', 'quickfix50', 'quickfix50sp1', 'quickfix50sp2'], + py_modules=[ + 'quickfix', + 'quickfixt11', + 'quickfix40', + 'quickfix41', + 'quickfix42', + 'quickfix43', + 'quickfix44', + 'quickfix50', + 'quickfix50sp1', + 'quickfix50sp2' + ], data_files=[('share/quickfix', glob.glob('spec/FIX*.xml'))], author='Oren Miller', author_email='oren@quickfixengine.org', @@ -46,6 +56,10 @@ def build_extensions(self): download_url='http://www.quickfixengine.org', license=license, include_dirs=['C++'], - cmdclass = {'build_ext': build_ext_subclass }, - ext_modules=[Extension('_quickfix', glob.glob('C++/*.cpp'), extra_compile_args=['-std=c++0x'])], + cmdclass={'build_ext': build_ext_subclass}, + ext_modules=[ + Extension('_quickfix', + glob.glob('C++/*.cpp'), + extra_compile_args=['-std=c++0x']) + ], ) From 28652d783d7769a4936f0a3c0f3cf83e3e4250d2 Mon Sep 17 00:00:00 2001 From: rheineke Date: Sun, 30 Oct 2016 08:26:22 -0400 Subject: [PATCH 2/3] Documentation for macOS build process added --- README.md | 29 +++++++++++++++++++++++++++++ package-python.sh | 28 +++++++++++++++++++++++++++- quickfix-python/setup.py | 8 ++++---- 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..af3b620 --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Requirements # + +[QuickFIX] uses [Automake] to compile. Standard requirements for different platforms: + +#### Linux #### + +TODO + +#### macOS #### + +Use [HomeBrew] to install the necessary utilities: +* Install [HomeBrew]: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +* Install brew packages: brew install automake libtool + +#### Windows #### + +TODO + +# Compilation # + +* Build [QuickFIX]: bash package.sh `[quick_fix_version]` +* Build Python wrappers (will fail without push access to [QuickFIX package index]): bash package-python.sh +* Build Ruby wrappers: bash package-ruby.sh + +[Autotools]: http://www.gnu.org/software/automake/manual/html_node/index.html +[HomeBrew]: http://brew.sh/ +[QuickFIX]: http://www.quickfixengine.org/ +[QuickFIX package index]: https://pypi.python.org/pypi/quickfix + diff --git a/package-python.sh b/package-python.sh index dc93302..d95a7a5 100755 --- a/package-python.sh +++ b/package-python.sh @@ -1,3 +1,25 @@ +#!/usr/bin/env bash +# +# Compile and install Python QuickFIX package. Default behavior uploads to PyPI. +# Use -d optional argument for local installation only +# +# Usage: +# bash package-python.sh [-d] + +PRODUCTION=0 + +while getopts "d" opt; do + case $opt in + d) + PRODUCTION=1 + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + esac +done + rm -rf quickfix-python/C++ rm -rf quickfix-python/spec rm -rf quickfix-python/quickfix*.py @@ -24,4 +46,8 @@ rm -f quickfix-python/C++/stdafx.* pushd quickfix-python -python setup.py sdist upload -r pypi +if [ "$PRODUCTION" -eq "0" ]; then + python setup.py sdist upload -r pypi +else + python setup.py install +fi diff --git a/quickfix-python/setup.py b/quickfix-python/setup.py index a7de2cb..9820cae 100644 --- a/quickfix-python/setup.py +++ b/quickfix-python/setup.py @@ -29,8 +29,8 @@ def build_extensions(self): build_ext.build_extensions(self) long_description = '' -with open('LICENSE') as file: - license = file.read(); +with open('LICENSE') as fp: + quickfix_license = fp.read() setup(name='quickfix', version='1.14.3', @@ -54,7 +54,7 @@ def build_extensions(self): description="FIX (Financial Information eXchange) protocol implementation", url='http://www.quickfixengine.org', download_url='http://www.quickfixengine.org', - license=license, + license=quickfix_license, include_dirs=['C++'], cmdclass={'build_ext': build_ext_subclass}, ext_modules=[ @@ -62,4 +62,4 @@ def build_extensions(self): glob.glob('C++/*.cpp'), extra_compile_args=['-std=c++0x']) ], -) + ) From 8d7f425b125dc530e055bbbca9a4e19d4e73647e Mon Sep 17 00:00:00 2001 From: rheineke Date: Sun, 30 Oct 2016 08:46:47 -0400 Subject: [PATCH 3/3] Readme formatting --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index af3b620..756ab6a 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ TODO #### macOS #### Use [HomeBrew] to install the necessary utilities: -* Install [HomeBrew]: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -* Install brew packages: brew install automake libtool +* Install [HomeBrew]: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` +* Install brew packages: `brew install automake libtool` #### Windows #### @@ -18,9 +18,9 @@ TODO # Compilation # -* Build [QuickFIX]: bash package.sh `[quick_fix_version]` -* Build Python wrappers (will fail without push access to [QuickFIX package index]): bash package-python.sh -* Build Ruby wrappers: bash package-ruby.sh +* Build [QuickFIX]: `bash package.sh [quick_fix_version]` +* Build Python wrappers: `bash package-python.sh [-d]` +* Build Ruby wrappers: `bash package-ruby.sh` [Autotools]: http://www.gnu.org/software/automake/manual/html_node/index.html [HomeBrew]: http://brew.sh/