aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Formula/euler-py.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/Library/Formula/euler-py.rb b/Library/Formula/euler-py.rb
new file mode 100644
index 000000000..9502309a8
--- /dev/null
+++ b/Library/Formula/euler-py.rb
@@ -0,0 +1,37 @@
+require "formula"
+
+class EulerPy < Formula
+ homepage "https://github.com/iKevinY/EulerPy"
+ url "https://github.com/iKevinY/EulerPy/archive/v1.2.3.tar.gz"
+ sha1 "88d97d7807f6b06ebfe475eee31ebd021b4ef275"
+
+ depends_on :python if MacOS.version <= :snow_leopard
+
+ resource "click" do
+ url "https://pypi.python.org/packages/source/c/click/click-3.3.tar.gz"
+ sha1 "d716a932b930d71059e49465b6b42e833808369a"
+ end
+
+ def install
+ ENV.prepend_create_path "PYTHONPATH", "#{libexec}/lib/python2.7/site-packages"
+ resource("click").stage do
+ system "python", "setup.py", "install", "--prefix=#{libexec}"
+ end
+
+ ENV.prepend_create_path "PYTHONPATH", "#{lib}/python2.7/site-packages"
+ system "python", "setup.py", "install", "--prefix=#{prefix}",
+ "--single-version-externally-managed", "--record=installed.txt"
+
+ bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"])
+ end
+
+ test do
+ require "open3"
+ Open3.popen3("#{bin}/euler") do |stdin, stdout, _|
+ stdin.write("\n")
+ stdin.close
+ assert_match 'Successfully created "001.py".', stdout.read
+ end
+ assert_equal 0, $?.exitstatus
+ end
+end