class Khal < Formula desc "CLI calendar application." homepage "https://github.com/geier/khal" url "https://pypi.python.org/packages/source/k/khal/khal-0.8.1.tar.gz" sha256 "9d352e4aa6256e493d5aea69540f642158bdcab75d2383e1e43506bf89982094" bottle do cellar :any_skip_relocation sha256 "0c0b38ea75552435b8e2af3a16b4e34cc9400408ca1cd05423ca0d64d80d099e" => :el_capitan sha256 "a2b38974f8a2cec62ed9e634172bb87314fcdb21491ff87e84fa98722433342b" => :yosemite sha256 "abbefa48883bf951a4cea5a25a264b136703b3ebaad19f9d552f4c8875c90da2" => :mavericks end depends_on :python3 resource "pkginfo" do url "https://pypi.python.org/packages/source/p/pkginfo/pkginfo-1.2.1.tar.gz" sha256 "ad3f6dfe8a831f96a7b56a588ca874137ca102cc6b79fc9b0a1c3b7ab7320f3c" end resource "icalendar" do url "https://pypi.python.org/packages/source/i/icalendar/icalendar-3.9.0.tar.gz" sha256 "93d0b94eab23d08f62962542309916a9681f16de3d5eca1c75497f30f1b07792" end resource "urwid" do url "https://pypi.python.org/packages/source/u/urwid/urwid-1.3.0.tar.gz" sha256 "29f04fad3bf0a79c5491f7ebec2d50fa086e9d16359896c9204c6a92bc07aba2" end resource "pyxdg" do url "https://pypi.python.org/packages/source/p/pyxdg/pyxdg-0.25.tar.gz" sha256 "81e883e0b9517d624e8b0499eb267b82a815c0b7146d5269f364988ae031279d" end resource "pytz" do url "https://pypi.python.org/packages/source/p/pytz/pytz-2015.4.tar.gz" sha256 "c4ee70cb407f9284517ac368f121cf0796a7134b961e53d9daf1aaae8f44fb90" end resource "six" do url "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz" sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a" end resource "python-dateutil" do url "https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz" sha256 "3e95445c1db500a344079a47b171c45ef18f57d188dffdb0e4165c71bea8eb3d" end resource "click" do url "https://pypi.python.org/packages/source/c/click/click-6.3.tar.gz" sha256 "b720d9faabe193287b71e3c26082b0f249501288e153b7e7cfce3bb87ac8cc1c" end resource "click_threading" do url "https://pypi.python.org/packages/source/c/click-threading/click-threading-0.1.2.tar.gz" sha256 "85045457e02f16fba3110dc6b16e980bf3e65433808da2b550dd513206d9b94a" end resource "click_log" do url "https://pypi.python.org/packages/source/c/click-log/click-log-0.1.3.tar.gz" sha256 "fd8dc8d65947ce6d6ee8ab3101fb0bb9015b9070730ada3f73ec761beb0ead4d" end resource "configobj" do url "https://pypi.python.org/packages/source/c/configobj/configobj-5.0.6.tar.gz" sha256 "a2f5650770e1c87fb335af19a9b7eb73fc05ccf22144eb68db7d00cd2bcb0902" end resource "tzlocal" do url "https://pypi.python.org/packages/source/t/tzlocal/tzlocal-1.1.3.tar.gz" sha256 "1950d112ed1b717683280d54f1e7a4533564d479127162cbf247bd0fb3708983" end resource "vdirsyncer" do url "https://pypi.python.org/packages/source/v/vdirsyncer/vdirsyncer-0.9.3.tar.gz" sha256 "8ca2941bb99c5b67f0f9e7cae3dd65fcbd64b8969515c68d44e6f3cd9cfc50f2" end resource "requests" do url "https://pypi.python.org/packages/source/r/requests/requests-2.9.1.tar.gz" sha256 "c577815dd00f1394203fc44eb979724b098f88264a9ef898ee45b8e5e9cf587f" end resource "requests-toolbelt" do url "https://pypi.python.org/packages/source/r/requests-toolbelt/requests-toolbelt-0.6.0.tar.gz" sha256 "cc4e9c0ef810d6dfd165ca680330b65a4cf8a3f08f5f08ecd50a0253a08e541f" end resource "lxml" do url "https://pypi.python.org/packages/source/l/lxml/lxml-3.5.0.tar.gz" sha256 "349f93e3a4b09cc59418854ab8013d027d246757c51744bf20069bc89016f578" end resource "atomicwrites" do url "https://pypi.python.org/packages/source/a/atomicwrites/atomicwrites-0.1.9.tar.gz" sha256 "7cdfcee8c064bc0ba30b0444ba0919ebafccf5b0b1916c8cde07e410042c4023" end def install version = Language::Python.major_minor_version "python3" ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{version}/site-packages" resources.each do |r| r.stage do system "python3", *Language::Python.setup_install_args(libexec/"vendor") end end ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{version}/site-packages" system "python3", *Language::Python.setup_install_args(libexec) bin.install Dir["#{libexec}/bin/*"] bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end test do ENV["LC_ALL"] = "en_US.UTF-8" ENV["LANG"] = "en_US.UTF-8" (testpath/".calendar/test/01ef8547.ics").write <<-EOS.undent BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT DTSTART;VALUE=DATE:20130726 SUMMARY:testevent DTEND;VALUE=DATE:20130727 LAST-MODIFIED:20130725T142824Z DTSTAMP:20130725T142824Z CREATED:20130725T142824Z UID:01ef8547 END:VEVENT END:VCALENDAR EOS (testpath/".config/khal/khal.conf").write <<-EOS.undent [calendars] [[test]] path = #{testpath}/.calendar/test/ color = light gray [sqlite] path = #{testpath}/.calendar/khal.db [locale] firstweekday = 0 [default] default_calendar = test EOS system "#{bin}/khal", "--no-color", "search", "testevent" end end