Merge pull request #6485 from dawidd6/create-python

create: add --python option
This commit is contained in:
Mike McQuaid 2019-09-25 13:20:53 +01:00 committed by GitHub
commit 1279bba345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 2 deletions

View File

@ -27,6 +27,8 @@ module Homebrew
description: "Create a basic template for a Go build." description: "Create a basic template for a Go build."
switch "--meson", switch "--meson",
description: "Create a basic template for a Meson-style build." description: "Create a basic template for a Meson-style build."
switch "--python",
description: "Create a basic template for a Python build."
switch "--no-fetch", switch "--no-fetch",
description: "Homebrew will not download <URL> to the cache and will thus not add its SHA-256 "\ description: "Homebrew will not download <URL> to the cache and will thus not add its SHA-256 "\
"to the formula for you, nor will it check the GitHub API for GitHub projects "\ "to the formula for you, nor will it check the GitHub API for GitHub projects "\
@ -42,7 +44,7 @@ module Homebrew
switch :force switch :force
switch :verbose switch :verbose
switch :debug switch :debug
conflicts "--autotools", "--cmake", "--go", "--meson" conflicts "--autotools", "--cmake", "--go", "--meson", "--python"
end end
end end
@ -77,6 +79,8 @@ module Homebrew
:meson :meson
elsif args.go? elsif args.go?
:go :go
elsif args.python?
:python
end end
if fc.name.nil? || fc.name.strip.empty? if fc.name.nil? || fc.name.strip.empty?

View File

@ -85,6 +85,10 @@ module Homebrew
# https://rubydoc.brew.sh/Formula # https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class #{Formulary.class_s(name)} < Formula class #{Formulary.class_s(name)} < Formula
<% if mode == :python %>
include Language::Python::Virtualenv
<% end %>
desc "#{desc}" desc "#{desc}"
homepage "#{homepage}" homepage "#{homepage}"
<% if head? %> <% if head? %>
@ -104,10 +108,20 @@ module Homebrew
<% elsif mode == :meson %> <% elsif mode == :meson %>
depends_on "meson" => :build depends_on "meson" => :build
depends_on "ninja" => :build depends_on "ninja" => :build
<% elsif mode == :python %>
depends_on "python"
<% elsif mode.nil? %> <% elsif mode.nil? %>
# depends_on "cmake" => :build # depends_on "cmake" => :build
<% end %> <% end %>
<% if mode == :python %>
# Additional Python dependency
# resource "" do
# url ""
# sha256 ""
# end
<% end %>
def install def install
# ENV.deparallelize # if your formula fails when building in parallel # ENV.deparallelize # if your formula fails when building in parallel
<% if mode == :cmake %> <% if mode == :cmake %>
@ -126,6 +140,8 @@ module Homebrew
system "ninja", "-v" system "ninja", "-v"
system "ninja", "install", "-v" system "ninja", "install", "-v"
end end
<% elsif mode == :python %>
virtualenv_install_with_resources
<% else %> <% else %>
# Remove unrecognized options if warned by configure # Remove unrecognized options if warned by configure
system "./configure", "--disable-debug", system "./configure", "--disable-debug",
@ -134,7 +150,7 @@ module Homebrew
"--prefix=\#{prefix}" "--prefix=\#{prefix}"
# system "cmake", ".", *std_cmake_args # system "cmake", ".", *std_cmake_args
<% end %> <% end %>
<% if mode != :meson and mode != :go %> <% if mode == :autotools or mode == :cmake %>
system "make", "install" # if this fails, try separate make/make install steps system "make", "install" # if this fails, try separate make/make install steps
<% end %> <% end %>
end end

View File

@ -805,6 +805,8 @@ a simple example. For the complete API, see:
Create a basic template for a Go build. Create a basic template for a Go build.
* `--meson`: * `--meson`:
Create a basic template for a Meson-style build. Create a basic template for a Meson-style build.
* `--python`:
Create a basic template for a Python build.
* `--no-fetch`: * `--no-fetch`:
Homebrew will not download *`URL`* to the cache and will thus not add its SHA-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage). Homebrew will not download *`URL`* to the cache and will thus not add its SHA-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage).
* `--HEAD`: * `--HEAD`:

View File

@ -1028,6 +1028,10 @@ Create a basic template for a Go build\.
Create a basic template for a Meson\-style build\. Create a basic template for a Meson\-style build\.
. .
.TP .TP
\fB\-\-python\fR
Create a basic template for a Python build\.
.
.TP
\fB\-\-no\-fetch\fR \fB\-\-no\-fetch\fR
Homebrew will not download \fIURL\fR to the cache and will thus not add its SHA\-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage)\. Homebrew will not download \fIURL\fR to the cache and will thus not add its SHA\-256 to the formula for you, nor will it check the GitHub API for GitHub projects (to fill out its description and homepage)\.
. .