from os import listdir, getcwd, system
from os.path import isfile, join
from subprocess import call
import sys
VERSION = '2.0-early-access11'

# TODO make this portable
SEPARATOR = "/"

file_name_base = "download-" + VERSION
file_name_php = file_name_base + ".php"
file_name_tgz = file_name_base + " .tar.gZ"

system("wget".join(["http://ocamljava.x9c.fr/preview/" + file_name_php]))
system("tar".join(["-xvf", file_name_tgz]))

MYPATH = getcwd() 

onlyfiles = [f for f in listdir(MYPATH) if isfile(join(MYPATH,f)) and (str(f)).split('.')[1] == "xml"]

for f in onlyfiles :
	pomFile = str(f)
	inferedJar = getcwd() + SEPARATOR + "ocamljava-" + VERSION + SEPARATOR + "lib" + SEPARATOR + pomFile

	command_args = " ".join(["mvn", "install:install-file", "-Dfile=" + inferedJar, "-DpomFile=" + pomFile])
	system(command_args)

@@ -1,12 +1,30 @@
+#!/usr/bin/python%0A
 from os impo
@@ -87,362 +87,442 @@
 oin%0A
-from subprocess import call%0Aimport sys%0AVERSION = '2.0-early-access11'%0A%0A# TODO make this portable%0ASEPARATOR = %22/%22%0A%0Afile_name_base = %22download-%22 + VERSION%0Afile_name_php = file_name_base + %22.php%22%0Afile_name_tgz = file_name_base
+import ntpath%0A%0AVERSION = '2.0-early-access11'%0A%0AFILE_NAME_BASE = %22download-%22 + VERSION%0AFILE_NAME_PHP = FILE_NAME_BASE + %22.php%22%0AFILE_NAME_TGZ = FILE_NAME_BASE
  + %22
- 
 .tar.g
-Z%22%0A%0Asystem(%22wget%22.join(%5B%22http://ocamljava.x9c.fr/preview/%22 + file_name_php%5D))%0Asystem(%22tar%22.join(%5B%22-xvf%22, file_name_tgz%5D)
+z%22%0A%0ACOMMAND = %22 %22.join(%5B%22wget%22, %22-O%22, FILE_NAME_TGZ,%0A%09%22http://ocamljava.x9c.fr/preview/%22 + FILE_NAME_PHP%5D)%0A%0Aprint %22Getting ocamljava: %22 + COMMAND%0A#system(COMMAND)%0A%0ACOMMAND = %22 %22.join(%5B%22tar%22, %22-zxvf%22, FILE_NAME_TGZ%5D)%0A%0Aprint %22Extracting files: %22 + COMMAND%0Asystem(COMMAND
 )%0A%0AM
@@ -529,24 +529,29 @@
 YPATH = 
+join(
 getcwd()
  %0A%0Aonlyf
@@ -546,20 +546,52 @@
 wd()
- %0A%0Aonlyfiles
+, %22ocamljava-%22 + VERSION, %22lib%22)%0A%0AONLY_FILES
  = %5B
@@ -619,17 +619,19 @@
 PATH) if
- 
+%0A%09%09
 isfile(j
@@ -641,16 +641,17 @@
 (MYPATH,
+ 
 f)) and 
@@ -681,11 +681,11 @@
 == %22
-xml
+jar
 %22%5D%0A%0A
@@ -697,142 +697,198 @@
  in 
-onlyfiles :%0A%09pomFile = str(f)%0A%09inferedJar = getcwd() + SEPARATOR + %22ocamljava-%22 + VERSION + SEPARATOR + %22lib%22 + SEPARATOR + pomFile%0A%0A%09
+ONLY_FILES:%0A    jarFile = join(getcwd(), %22ocamljava-%22 + VERSION, %22lib%22, str(f))%0A    baseName = ntpath.basename(jarFile).split('.')%5B0%5D%0A    pomFile = join(getcwd(), baseName + %22-pom.xml%22)%0A    
 comm
@@ -938,16 +938,21 @@
 l-file%22,
+%0A%09   
  %22-Dfile
@@ -960,18 +960,15 @@
 %22 + 
-inferedJar
+jarFile
 , %22-
@@ -990,17 +990,20 @@
 mFile%5D)%0A
-%09
+    
 system(c

fix python install script