Hi Rob,

I made the changes src/leiningen/jar.clj that you suggested.
Then issued the commands:

E:\etc\clojure\Leiningen\lein.py clean
E:\etc\clojure\Leiningen\lein.py deps
E:\etc\clojure\Leiningen\lein.py compile
E:\etc\clojure\Leiningen\lein.py jar
E:\etc\clojure\Leiningen\lein.py uberjar

and they all work to compile the new Leiningen.
(Fyi, I originally didn’t have the 'lein.py deps' step
and this seems to be essential, in my case.)

Then in the python script (lein.py), I set

LEIN_JAR   = expanduser("E:/keep/eclipse/3.5/git-leiningen/src/
leiningen-standalone.jar")
CLOJURE_JAR = expanduser("E:/keep/eclipse/3.5/git-leiningen/src/lib/
clojure-1.1.0-master-20091218.160125-7.jar")

i.e. to point at the newly compiled leiningen and the version of
clojure
that it downloaded into its 'lib' folder.

I then tried the simple example at
http://zef.me/2470/building-clojure-projects-with-leiningen
using this project.clj

(defproject helloworld "0.1"
    :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"]
                   [org.clojure/clojure-contrib "1.0-SNAPSHOT"]]
    :main helloworld)

to correspond to the project.clj in E:/keep/eclipse/3.5/git-leiningen/
src
which contains

(defproject leiningen "1.1.0-SNAPSHOT"
  :description "A build tool designed not to set your hair on fire."
  :url "http://github.com/technomancy/leiningen";
  :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"]
                 [org.clojure/clojure-contrib "1.0-SNAPSHOT"]
                 [ant/ant-launcher "1.6.2"]
                 [jline "0.9.94"]
                 [org.apache.maven/maven-ant-tasks "2.0.10"]]
  :dev-dependencies [[leiningen/lein-swank "1.0.0-SNAPSHOT"]]
  :main leiningen.core)

I am able to compile the helloworld example:

E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py compile
     [copy] Copying 2 files to E:\keep\clojure\helloworld\lib
Compiling helloworld

But 'lein.py uberjar' or 'lein.py jar' both produce stange errors:

E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py uberjar
Wrong number of arguments to task uberjar.
E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py jar
Wrong number of arguments to task jar.

and so does 'lein.py new'

E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py new
Wrong number of arguments to task new.
E:\keep\clojure\helloworld>E:\etc\clojure\Leiningen\lein.py version
Leiningen nil on Java 1.6.0_18-ea Java HotSpot(TM) Client VM

This seems to be a different issue (possibly with the lein.py
script?).
Any pointers would be very welcome.

Regards,

John.

On Dec 19, 10:25 pm, Rob Wolfe <r...@smsnet.pl> wrote:
> John <john.b.ga...@gmail.com> writes:
> > Hi,
>
> > I am trying to use lein.py, from above, on Windows (Vista).
>
> > It works nicely for some commands (e.g. lein.py compile),
> > after removing the extra space in two places e.g.
> > 'leiningen-%s-standalone .jar' ->
> > 'leiningen-%s-standalone.jar'
> > and
> > '1.1.0-alpha-SNAPSHOT/cloju re-1.1.0-alpha-SNAPSHOT.jar' ->
> > '1.1.0-alpha-SNAPSHOT/clojure-1.1.0-alpha-SNAPSHOT.jar'
>
> It's really strange. These additional spaces don't exist in my original 
> script.
> They were added by google groups or something.
>
>
>
>
>
> > But I still have the following error with the 'lein.py install' and
> > 'lein.py jar' commands:
>
> > E:\temp\leiningen\myproject> E:\etc\clojure\Leiningen\lein.py install
> > Exception in thread "main" java.util.regex.PatternSyntaxException:
> > Illegal/unsupported escape sequence near index 9
> > ^E:\temp\leiningen\myproject
> >          ^ (NO_SOURCE_FILE:0)
> >         at clojure.lang.Compiler.eval(Compiler.java:5274)
> >         at clojure.lang.Compiler.eval(Compiler.java:5226)
> > ...
>
> > E:\temp\leiningen\myproject> E:\etc\clojure\Leiningen\lein.py jar
> > Exception in thread "main" java.util.regex.PatternSyntaxException:
> > Illegal/unsupported escape sequence near index 9
> > ^E:\temp\leiningen\myproject
> >          ^ (NO_SOURCE_FILE:0)
> >         at clojure.lang.Compiler.eval(Compiler.java:5274)
> >         at clojure.lang.Compiler.eval(Compiler.java:5226)
> > ...
>
> > I am guessing that this means that the backslash in 'temp\leiningen'
> > needs to be escaped
> > somewhere in the python script (lein.py) above.
> > (I am not clear why the first backslash (in E:\temp) is not reported
> > as the error (index 4).)
>
> > I have tried many guesses (I am not familiar with python (V2.6)).
> > Can anyone make some suggestions?
>
> I don't think it is `lein.py` problem anymore.
> Leiningen uses regular expressions on paths and as usually
> there is a problem with windows path separator.
> I took a look in leiningen source and this small patch made
> command "jar" working for me on Windows
> (I haven't looked at "install" command, but probably it is the same
> problem):
>
> <patch>
>
> diff --git a/src/leiningen/jar.clj b/src/leiningen/jar.clj
> index 227bccd..d1dd766 100644
> --- a/src/leiningen/jar.clj
> +++ b/src/leiningen/jar.clj
> @@ -22,13 +22,17 @@
>                          (str "Main-Class: " main))])
>             "\n")))))
>
> +(defn unix-path [path]
> +  (.replaceAll path "\\\\" "/"))
> +
>  (defmulti copy-to-jar (fn [project jar-os spec] (:type spec)))
>
>  (defmethod copy-to-jar :path [project jar-os spec]
>    (doseq [child (file-seq (file (:path spec)))]
>      (when-not (.isDirectory child)
> -      (let [path (str child)
> -            path (re-sub (re-pattern (str "^" (:root project))) "" path)
> +      (let [path (unix-path (str child))
> +            path (re-sub (re-pattern (str "^" (unix-path (:root project))))
> +                         "" path)
>              path (re-sub #"^/resources" "" path)
>              path (re-sub #"^/classes" "" path)
>              path (re-sub #"^/src" "" path)
>
> </patch>
>
> HTH,
> Rob

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to