Makefile: Ultimate SDK detection patch. The following works: (issue 5671091)

1 view
Skip to first unread message

tech...@gmail.com

unread,
Feb 18, 2012, 3:12:28 AM2/18/12
to albrec...@googlemail.com, mar...@chromium.org, coderev...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: Andi Albrecht, M-A,

Description:
Makefile: Ultimate SDK detection patch. The following works:

# if SDK is in ../google_appengine
make serve
# if SDK is in PATH
make serve
# if SDK is ../appengine/sdk
SDK_PATH=../appengine/sdk make serve

Please review this at http://codereview.appspot.com/5671091/

Affected files:
M Makefile


Index: Makefile
===================================================================
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,14 @@
# Makefile to simplify some common AppEngine actions.
# Use 'make help' for a list of commands.

-SDK_PATH ?=
+# Detecting AppEngine SDK location
+ifeq ($(wildcard ../google_appengine/dev_appserver.py),)
+ # SDK is not found in parent dir, you may want to set it here manually
+ # (note: ?= below means 'set variable iff it isn't set already')
+ SDK_PATH ?=
+else
+ SDK_PATH ?= ../google_appengine
+endif

DEV_APPSERVER?= $(if $(SDK_PATH), $(SDK_PATH)/,)dev_appserver.py
DEV_APPSERVER_FLAGS?=


gvanr...@gmail.com

unread,
Feb 18, 2012, 1:00:13 PM2/18/12
to tech...@gmail.com, albrec...@googlemail.com, mar...@chromium.org, coderev...@googlegroups.com, re...@codereview-hr.appspotmail.com
By default the SDK installs in /usr/local/google_appengine, at least on
Linux and Mac. (This is where the Mac launcher puts/copies it, for
example.) Why not include that path too? (It's what I use. :-)

http://codereview.appspot.com/5671091/

tech...@gmail.com

unread,
Feb 18, 2012, 3:57:35 PM2/18/12
to albrec...@googlemail.com, mar...@chromium.org, gvanr...@gmail.com, coderev...@googlegroups.com, re...@codereview-hr.appspotmail.com
I am not a Makefile guru, but I'll try if time permits.

It feels wrong that this file is not in Python. SCons/Fabric tool in
standard library would be awesome. =)

http://codereview.appspot.com/5671091/

Guido van Rossum

unread,
Feb 18, 2012, 4:27:56 PM2/18/12
to tech...@gmail.com, albrec...@googlemail.com, mar...@chromium.org, gvanr...@gmail.com, coderev...@googlegroups.com, re...@codereview-hr.appspotmail.com
On Sat, Feb 18, 2012 at 12:57 PM, <tech...@gmail.com> wrote:
> I am not a Makefile guru, but I'll try if time permits.

Don't worry about it, it works for me even now, because
dev_appserver.py and appcfg.py are in my $PATH.

> It feels wrong that this file is not in Python. SCons/Fabric tool in
> standard library would be awesome. =)

Blame me. I like to use Make as an alternative for a bunch of tiny
shell scripts. Note that there is no actual "building" going on in
this Makefile; there are no real dependencies. My original idea was to
just use the Makefile as a shortcut for somewhat complex command
lines, so you don't have to remember all the necessary flags, and
invocations like "make deploy" or "make test" are somewhat uniform
across projects even if the implementations aren't.

Make is really overkill, except it is always installed and has a
pretty optimized command line, with a nice default and a nice way to
create aliases and groups of commands. Requiring SCons/Fabric would be
*really* overkill. Writing a Python script would be more work -- you'd
have to do a fair amount of command line parsing just to get started.
You could streamline this through a bunch of Bash aliases/functions
too, but I'm less familiar with those, and I like that it's localized
to the directory, always available when I'm in the directory, and
simple enough that if Make somehow isn't installed, you can still
figure out what to do just by reading the Makefile.

--
--Guido van Rossum (python.org/~guido)

Reply all
Reply to author
Forward
0 new messages