mat: general cleanup.
Modernizes the MAT formula a little, especially around the handling of the Python elements. Closes Homebrew/homebrew#33923.
This commit is contained in:
parent
daf3072b46
commit
5efdef4a8f
1 changed files with 49 additions and 40 deletions
|
@ -1,8 +1,8 @@
|
|||
require "formula"
|
||||
|
||||
# OSX has case-insensitive file names, and the Mat archive contains a 'MAT'
|
||||
# directory *and* a 'mat' file. `tar xf` will fail on it, so we rename 'mat'
|
||||
# into 'mat-cli' here.
|
||||
# OSX has case-insensitive file names, and the Mat archive contains a "MAT"
|
||||
# directory *and* a "mat" file. `tar xf` will fail on it, so we rename "mat"
|
||||
# into "mat-cli" here.
|
||||
class MatDownloadStrategy < CurlDownloadStrategy
|
||||
def stage
|
||||
if tarball_path.compression_type == :xz
|
||||
|
@ -21,70 +21,79 @@ class Mat < Formula
|
|||
url "https://mat.boum.org/files/mat-0.5.2.tar.xz", :using => MatDownloadStrategy
|
||||
sha1 "932ac13863c994ca8874e3271f817efd879e28c3"
|
||||
|
||||
depends_on :python
|
||||
depends_on 'coreutils'
|
||||
depends_on 'poppler'
|
||||
depends_on 'intltool' => :build
|
||||
depends_on 'gettext' => :build
|
||||
depends_on :python => :optional
|
||||
depends_on "coreutils"
|
||||
depends_on "poppler"
|
||||
depends_on "intltool" => :build
|
||||
depends_on "gettext" => :build
|
||||
|
||||
depends_on 'exiftool' => :optional
|
||||
depends_on "exiftool" => :optional
|
||||
|
||||
option 'with-massive-audio', 'Enable massive audio format support'
|
||||
option "with-massive-audio", "Enable massive audio format support"
|
||||
|
||||
# mat relies on `shred`, which is called `gshred` on OSX with coreutils, and
|
||||
# import the 'gi' python module which is not available here.
|
||||
# import the "gi" python module which is not available here.
|
||||
# Fixed upstream for next version.
|
||||
patch :DATA
|
||||
|
||||
resource 'hachoir-core' do
|
||||
url 'https://pypi.python.org/packages/source/h/hachoir-core/hachoir-core-1.3.3.tar.gz'
|
||||
sha1 'e1d3b5da7d57087c922942b7653cb3b195c7769f'
|
||||
resource "hachoir-core" do
|
||||
url "https://pypi.python.org/packages/source/h/hachoir-core/hachoir-core-1.3.3.tar.gz"
|
||||
sha1 "e1d3b5da7d57087c922942b7653cb3b195c7769f"
|
||||
end
|
||||
|
||||
resource 'hachoir-parser' do
|
||||
url 'https://pypi.python.org/packages/source/h/hachoir-parser/hachoir-parser-1.3.4.tar.gz'
|
||||
sha1 '8433e1598b1e8d9404e6978117a203775e68c075'
|
||||
resource "hachoir-parser" do
|
||||
url "https://pypi.python.org/packages/source/h/hachoir-parser/hachoir-parser-1.3.4.tar.gz"
|
||||
sha1 "8433e1598b1e8d9404e6978117a203775e68c075"
|
||||
end
|
||||
|
||||
resource 'pdfrw' do
|
||||
url 'https://pypi.python.org/packages/source/p/pdfrw/pdfrw-0.1.tar.gz'
|
||||
sha1 '9824ad502ecb2bf093fd8727fd7fa2b524140e41'
|
||||
resource "pdfrw" do
|
||||
url "https://pypi.python.org/packages/source/p/pdfrw/pdfrw-0.1.tar.gz"
|
||||
sha1 "9824ad502ecb2bf093fd8727fd7fa2b524140e41"
|
||||
end
|
||||
|
||||
resource 'distutils-extra' do
|
||||
url 'https://launchpad.net/python-distutils-extra/trunk/2.38/+download/python-distutils-extra-2.38.tar.gz'
|
||||
sha1 'db9ac81daf3e069b8838ae6d379abac2f0094663'
|
||||
resource "distutils-extra" do
|
||||
url "https://launchpad.net/python-distutils-extra/trunk/2.38/+download/python-distutils-extra-2.38.tar.gz"
|
||||
sha1 "db9ac81daf3e069b8838ae6d379abac2f0094663"
|
||||
end
|
||||
|
||||
resource 'mutagen' do
|
||||
url 'https://pypi.python.org/packages/source/m/mutagen/mutagen-1.22.tar.gz'
|
||||
sha1 '9bdd4a7a491008e62d140d83fc31d355577f94e7'
|
||||
resource "mutagen" do
|
||||
url "https://pypi.python.org/packages/source/m/mutagen/mutagen-1.22.tar.gz"
|
||||
sha1 "9bdd4a7a491008e62d140d83fc31d355577f94e7"
|
||||
end
|
||||
|
||||
def install
|
||||
ENV.prepend_create_path 'PYTHONPATH', libexec/'lib/python2.7/site-packages'
|
||||
install_args = [ "setup.py", "install", "--prefix=#{libexec}" ]
|
||||
ENV["PYTHONPATH"] = lib+"python2.7/site-packages"
|
||||
ENV.prepend_create_path "PYTHONPATH", libexec+"lib/python2.7/site-packages"
|
||||
|
||||
resource('hachoir-core').stage { system "python", *install_args }
|
||||
resource('hachoir-parser').stage { system "python", *install_args }
|
||||
resource('pdfrw').stage { system "python", *install_args }
|
||||
resource('distutils-extra').stage { system "python", *install_args }
|
||||
if build.with? 'massive-audio'
|
||||
resource('mutagen').stage { system "python", *install_args }
|
||||
%w[hachoir-core hachoir-parser pdfrw distutils-extra].each do |r|
|
||||
resource(r).stage do
|
||||
pyargs = ["setup.py", "install", "--prefix=#{libexec}"]
|
||||
unless %w[hachoir-core hachoir-parser pdfrw].include? r
|
||||
pyargs << "--single-version-externally-managed" << "--record=installed.txt"
|
||||
end
|
||||
system "python", *pyargs
|
||||
end
|
||||
end
|
||||
|
||||
inreplace 'setup.py' do |s|
|
||||
s.gsub!("'mat'", "'mat-cli'")
|
||||
if build.with? "massive-audio"
|
||||
resource("mutagen").stage do
|
||||
system "python", "setup.py", "install", "--prefix=#{libexec}"
|
||||
end
|
||||
end
|
||||
|
||||
# Installs Mat as mat-cli temporarily
|
||||
inreplace "setup.py", "'mat'", "'mat-cli'"
|
||||
|
||||
system "python", "setup.py", "install", "--prefix=#{prefix}"
|
||||
|
||||
# move executable back to its real name
|
||||
mv bin/'mat-cli', bin/'mat'
|
||||
mv bin/"mat-cli", bin/"mat"
|
||||
# Since we don't support it, Let's remove the GUI binary.
|
||||
rm bin/"mat-gui"
|
||||
# Install manpages into expected directory.
|
||||
man1.install Dir["*.1"]
|
||||
|
||||
man1.install Dir['*.1']
|
||||
|
||||
bin.env_script_all_files(libexec/'bin', :PYTHONPATH => ENV['PYTHONPATH'])
|
||||
bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"])
|
||||
end
|
||||
|
||||
test do
|
||||
|
|
Loading…
Reference in a new issue