Hi,

swedebugia <swedebu...@riseup.net> writes:
> I refactored my substitute* into that below.
> Now it runs without substitute anything :S

Actually, the first two substitutions worked, but not the latter two.
See below.

> +               (substitute* "setup.py"
> +                (("iptables_exe = ''")
> +                 (string-append "iptables_exe = '" iptables 
> "/sbin/iptables'"))
> +                (("iptables_dir = ''")
> +                 (string-append "iptables_dir = '" iptables  "/sbin/'"))
> +                (("real_confdir = os.path.join('/etc')")
> +                 (string-append "real_confdir = '" out  "/etc/'"))
> +                (("real_statedir = os.path.join('/lib', 'ufw')")
> +                 (string-append "real_statedir = '" out "/lib/ufw'"))))

In the latter two substitutions above, the parentheses '(' and ')' are
special characters in regular expression syntax.  In order to avoid
their special meaning, and match actual parentheses, you need to escape
them by preceding each with a backslash.  However, backslash is also a
special character in Scheme string literal syntax, so you need to put
two backslashes to get a single backslash in the actual string.  So, it
should look like this:

--8<---------------cut here---------------start------------->8---
  (substitute* "setup.py"
   (("iptables_exe = ''")
    (string-append "iptables_exe = '" iptables "/sbin/iptables'"))
   (("iptables_dir = ''")
    (string-append "iptables_dir = '" iptables  "/sbin/'"))
   (("real_confdir = os.path.join\\('/etc'\\)")
    (string-append "real_confdir = '" out  "/etc/'"))
   (("real_statedir = os.path.join\\('/lib', 'ufw'\\)")
    (string-append "real_statedir = '" out "/lib/ufw'"))))
--8<---------------cut here---------------end--------------->8---

With this change, the package builds, although I haven't done any
further testing.

      Mark

Reply via email to