Skip to content

Instantly share code, notes, and snippets.

@yoneken
Created January 8, 2015 00:20
Show Gist options
  • Save yoneken/e646423a5fcb9fecfc9e to your computer and use it in GitHub Desktop.
Save yoneken/e646423a5fcb9fecfc9e to your computer and use it in GitHub Desktop.
homebrew/Library/Formula/pyqwt.rb
require 'formula'
class Pyqwt < Formula
homepage 'http://pyqwt.sourceforge.net'
url 'https://downloads.sourceforge.net/project/pyqwt/pyqwt5/PyQwt-5.2.0/PyQwt-5.2.0.tar.gz'
sha1 '797f37c63dec660272f6a8ccfd16a017df0ad640'
depends_on :python
depends_on 'qt'
depends_on 'qwt'
depends_on 'sip'
depends_on 'pyqt'
# Patch to build system to allow for specific installation directories.
patch :p0, :DATA
def install
cd "configure" do
system "python",
"configure.py",
"--module-install-path=#{lib}/python2.7/site-packages/PyQt4/Qwt5",
"--sip-install-path=#{share}/sip/Qwt5",
"--uic-install-path=#{lib}/python2.7/site-packages/PyQt4",
"-Q", "../qwt-5.2"
system "make install"
system 'make clean'
end
end
test do
ENV["PYTHONPATH"] = lib+"python2.7/site-packages"
system "python", "-c", "from PyQt4 import Qwt5 as Qwt"
end
end
__END__
--- configure/configure.py 2011-10-24 19:14:41.000000000 -0500
+++ configure/configure.py 2011-10-24 19:15:03.000000000 -0500
@@ -846,14 +846,14 @@
pattern = os.path.join(os.pardir, 'sip', options.qwt, 'common', '*.sip')
sip_files += [os.path.join(os.pardir, f) for f in glob.glob(pattern)]
installs.append(
- [sip_files, os.path.join(configuration.pyqt_sip_dir, 'Qwt5')])
+ [sip_files, os.path.join(options.sip_install_path, 'Qwt5')])
# designer
if configuration.qt_version > 0x03ffff:
plugin_source_path = os.path.join(
os.pardir, 'qt4lib', 'PyQt4', 'uic', 'widget-plugins')
plugin_install_path = os.path.join(
- configuration.pyqt_mod_dir, 'uic', 'widget-plugins')
+ options.uic_install_path, 'uic', 'widget-plugins')
compileall.compile_dir(plugin_source_path, ddir=plugin_install_path)
pattern = os.path.join(plugin_source_path, '*.py*')
plugin_files = [os.path.join(os.pardir, f) for f in glob.glob(pattern)]
@@ -1025,6 +1025,14 @@
'--module-install-path', default='', action='store',
help= 'specify the install directory for the Python modules'
)
+ install_options.add_option(
+ '--sip-install-path', default='', action='store',
+ help= 'specify the install directory for the sip files [share/sip]'
+ )
+ install_options.add_option(
+ '--uic-install-path', default='', action='store',
+ help= 'specify the install directory for the uic plugins [lib/python/PyQt4]'
+ )
parser.add_option_group(install_options)
options, args = parser.parse_args()
@@ -1084,6 +1092,10 @@
if not options.module_install_path:
options.module_install_path = os.path.join(
configuration.pyqt_mod_dir, 'Qwt5')
+ if not options.sip_install_path:
+ options.sip_install_path = configuration.pyqt_sip_dir
+ if not options.uic_install_path:
+ options.uic_install_path = configuration.pyqt_mod_dir
print
print 'Extended command line options:'
--- support/qwt_ndarray.cpp 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_ndarray.cpp 2015-01-08 08:35:21.000000000 +0900
@@ -30,7 +30,7 @@
// PyQwt becomes a free plug-in for a non-free program.
-#include <Python.h>
+#include <Python/Python.h>
#include <qwt_ndarray.h>
--- support/qwt_ndarray.h 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_ndarray.h 2015-01-08 08:35:34.000000000 +0900
@@ -33,7 +33,7 @@
#ifndef QWT_NDARRAY_H
#define QWT_NDARRAY_H
-#include <Python.h>
+#include <Python/Python.h>
#include <qwt_array.h>
#include <qwt_numerical_interface.h>
--- support/qwt_numarray.cpp 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_numarray.cpp 2015-01-08 08:35:58.000000000 +0900
@@ -31,7 +31,7 @@
#ifdef HAS_NUMARRAY
-#include <Python.h>
+#include <Python/Python.h>
#include <numarray/arrayobject.h>
#include <qwt_numarray.h>
--- support/qwt_numarray.h 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_numarray.h 2015-01-08 08:36:13.000000000 +0900
@@ -34,7 +34,7 @@
#ifdef HAS_NUMARRAY
-#include <Python.h>
+#include <Python/Python.h>
#include <qwt_array.h>
#include <qwt_numerical_interface.h>
--- support/qwt_numeric.cpp 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_numeric.cpp 2015-01-08 08:36:50.000000000 +0900
@@ -31,7 +31,7 @@
#ifdef HAS_NUMERIC
-#include <Python.h>
+#include <Python/Python.h>
#include <Numeric/arrayobject.h>
#include <qwt_numeric.h>
--- support/qwt_numeric.h 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_numeric.h 2015-01-08 08:36:31.000000000 +0900
@@ -34,7 +34,7 @@
#ifdef HAS_NUMERIC
-#include <Python.h>
+#include <Python/Python.h>
#include <qimage.h>
#include <qwt_array.h>
#include <qwt_numerical_interface.h>
--- support/qwt_numerical_interface.h 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_numerical_interface.h 2015-01-08 08:37:10.000000000 +0900
@@ -32,7 +32,7 @@
#ifndef QWT_NUMERICAL_INTERFACE_H
#define QWT_NUMERICAL_INTERFACE_H
-#include <Python.h>
+#include <Python/Python.h>
#include <qimage.h>
#include <qwt_array.h>
--- support/qwt_numpy.cpp 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_numpy.cpp 2015-01-08 08:37:24.000000000 +0900
@@ -31,7 +31,7 @@
#ifdef HAS_NUMPY
-#include <Python.h>
+#include <Python/Python.h>
#include <numpy/arrayobject.h>
#include <qwt_numerical_interface.h>
#include <qwt_numpy.h>
--- support/qwt_numpy.h 2009-02-17 18:55:15.000000000 +0900
+++ support/qwt_numpy.h 2015-01-08 08:37:34.000000000 +0900
@@ -34,7 +34,7 @@
#ifdef HAS_NUMPY
-#include <Python.h>
+#include <Python/Python.h>
#include <qwt_array.h>
#include <qwt_numerical_interface.h>
@yoneken
Copy link
Author

yoneken commented Jan 8, 2015

When I install pyqwt on osx 10.9.5, I got a error "<Python.h>".

Simply, you should replace from "<Python.h>" to "<Python/Python.h>".

You also have to edit /usr/local/Cellar/sip/4.16.3_1/include/sip.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment