f6e80bdea2
New `depends_on :python` Dependency. New `depends_on :python3` Dependency. To avoid having multiple formulae with endings -py2 and -py3, we will handle support for different pythons (2.x vs. 3.x) in the same formula. Further brewed vs. external python will be transparently supported. The formula also gets a new object `python`, which is false if no Python is available or the user has disabled it. Otherwise it is defined and provides several support methods: python.site_packages # the site-packages in the formula's Cellar python.global_site_packages python.binary # the full path to the python binary python.prefix python.version python.version.major python.version.minor python.xy # => e.g. "python2.7" python.incdir # includes of python python.libdir # the python dylib library python.pkg_config_path # used internally by brew python.from_osx? python.framework? python.universal? python.pypy? python.standard_caveats # Text to set PYTHONPATH for python.from_osx? python.if3then3 # => "" for 2.x and to "3" for 3.x. Further, to avoid code duplication, `python` takes an optional block that is run twice if the formula defines depends_on :python AND :python3. python do system python, 'setup.py', "--prefix=#{prefix}" end Read more in the Homebrew wiki.
91 lines
3.1 KiB
Ruby
91 lines
3.1 KiB
Ruby
require 'formula'
|
|
|
|
class Pyqwt < Formula
|
|
homepage 'http://pyqwt.sourceforge.net'
|
|
url 'http://sourceforge.net/projects/pyqwt/files/pyqwt5/PyQwt-5.2.0/PyQwt-5.2.0.tar.gz'
|
|
sha1 '797f37c63dec660272f6a8ccfd16a017df0ad640'
|
|
|
|
depends_on :python => :recommended
|
|
depends_on 'qt'
|
|
depends_on 'qwt'
|
|
depends_on 'sip'
|
|
depends_on 'pyqt'
|
|
|
|
def patches
|
|
# Patch to build system to allow for specific
|
|
# installation directories.
|
|
{ :p0 => DATA }
|
|
end
|
|
|
|
def install
|
|
cd "configure" do
|
|
python do
|
|
system python,
|
|
"configure.py",
|
|
"--module-install-path=#{lib}/#{python.xy}/site-packages/PyQt4/Qwt5",
|
|
"--sip-install-path=#{share}/sip#{python.if3then3}/Qwt5",
|
|
"--uic-install-path=#{lib}/#{python.xy}/site-packages/PyQt4",
|
|
"-Q", "../qwt-5.2"
|
|
system "make install"
|
|
system 'make clean'
|
|
end
|
|
end
|
|
end
|
|
|
|
def caveats
|
|
python.standard_caveats if python
|
|
end
|
|
|
|
def test
|
|
python do
|
|
system python, "-c", "from PyQt4 import Qwt5 as Qwt"
|
|
end
|
|
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:'
|