git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] *** SUBJECT HERE ***
@ 2010-04-09 15:34 Brian Gernhardt
  2010-04-09 15:34 ` [PATCH] Makefile: Simplify handling of python scripts Brian Gernhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Brian Gernhardt @ 2010-04-09 15:34 UTC (permalink / raw)
  To: Git List; +Cc: Jakub Narebski

Changes from v1:
  - Moves valid FQDN conditions from line-ending conditions to a new
    function
  - Adds sendemail.smtpdomain to the list in config.txt

Patch 2/3 is unchanged.

Brian Gernhardt (3):
  send-email: Don't use FQDNs without a '.'
  Document send-email --smtp-domain
  send-email: Add sendemail.smtpdomain

 Documentation/config.txt         |    1 +
 Documentation/git-send-email.txt |    7 +++++++
 git-send-email.perl              |   32 ++++++++++++++++++--------------
 3 files changed, 26 insertions(+), 14 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [PATCH] Makefile: Remove excess backslashes from sed
@ 2010-04-09  5:57 Junio C Hamano
  2010-04-09 15:35 ` [PATCH] Makefile: Simplify handling of python scripts Brian Gernhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2010-04-09  5:57 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Git List

Brian Gernhardt <brian@gernhardtsoftware.com> writes:

> The sed script that was intended to add lines altering the sys.path
> had extra backslashes in them.  Instead resulting in
>
>   import sys;  import os;  sys.path.insert( ... )
>
> It output
>
>   import sys; \ import os; \ sys.path.insert( ... )
>
> Unfortunately this caused python (2.6.1 on OS X 10.6.3) to error
>
>   SyntaxError: unexpected character after line continuation character
>
> Removing two of the backslashes solves this problem.

Traditionally, multi-line sed statements written in the Makefile were
portability nightmare, as the line folding rules (especially how the
backslash is treated in the output) in make implementations were subtly
different, and implementations of sed also got multi-line statement often
wrong.  These days, things might have gotten much better, but in olden
days (back when BSD vs SysV war was still raging), the trick to write
things like this portably was to invoke a shell script that has multi-line
sed statement from the Makefile.  It was painful.

I wonder if we can make this a lot simpler to avoid multi-line sed script.
For example, we could write the source Python script to always begin with:

	#!/usr/bin/python
        import sys;
        import os;
        sys.path.insert(0, os.getenv("GITPYTHONLIB","."));

and then do something like this in the Makefile:

	INSTLIBDIR=... && \
	sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
        -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"'"$$INSTLIBDIR"'")|' \
        <$@.py >$@+
	mv $@+ $@

Contributors can then run things in-place while developing the scripts,
perhaps setting GITPYTHONLIB to the source area.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-04-10 13:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-09 15:34 [PATCH v2 0/3] *** SUBJECT HERE *** Brian Gernhardt
2010-04-09 15:34 ` [PATCH] Makefile: Simplify handling of python scripts Brian Gernhardt
2010-04-09 15:39   ` Sverre Rabbelier
2010-04-09 15:57     ` [PATCH v2] " Brian Gernhardt
2010-04-09 16:05       ` Sverre Rabbelier
2010-04-09 15:34 ` [PATCH v2 2/3] Document send-email --smtp-domain Brian Gernhardt
2010-04-09 15:34 ` [PATCH v2 3/3] send-email: Add sendemail.smtpdomain Brian Gernhardt
2010-04-09 18:40   ` Jakub Narebski
2010-04-10 13:51     ` Brian Gernhardt
2010-04-09 15:42 ` [PATCH v2 1/3] send-email: Don't use FQDNs without a '.' Brian Gernhardt
2010-04-09 16:31   ` Jakub Narebski
2010-04-10 13:44     ` Brian Gernhardt
  -- strict thread matches above, loose matches on Subject: below --
2010-04-09  5:57 [PATCH] Makefile: Remove excess backslashes from sed Junio C Hamano
2010-04-09 15:35 ` [PATCH] Makefile: Simplify handling of python scripts Brian Gernhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).