[sikuli] 98/385: minor fixes before beta
Gilles Filippini
pini at moszumanska.debian.org
Sun Jun 29 19:25:54 UTC 2014
This is an automated email from the git hooks/post-receive script.
pini pushed a commit to tag upstream/1.1.0_beta1
in repository sikuli.
commit 4001285fac3f01f548ffeab8513121df21ecb61f
Author: Raimund Hocke <rmhdevelop at me.com>
Date: Fri Jan 3 15:07:42 2014 +0100
minor fixes before beta
---
API/src/main/java/org/sikuli/script/SikuliX.java | 4 +-
.../main/java/org/sikuli/basics/FileManager.java | 16 +------
.../src/main/java/org/sikuli/basics/RunSetup.java | 50 +++++++++++++++-------
.../src/main/java/org/sikuli/basics/Settings.java | 10 ++---
.../src/main/java/org/sikuli/basics/SikuliX.java | 20 ++++++++-
Basics/src/main/resources/Commands/mac/runScript | 2 +-
Basics/src/main/resources/Lib/sikuli/Sikuli.py | 4 +-
.../sikuli/scriptrunner/JythonScriptRunner.java | 17 +++-----
8 files changed, 71 insertions(+), 52 deletions(-)
diff --git a/API/src/main/java/org/sikuli/script/SikuliX.java b/API/src/main/java/org/sikuli/script/SikuliX.java
index 090515f..d44628c 100644
--- a/API/src/main/java/org/sikuli/script/SikuliX.java
+++ b/API/src/main/java/org/sikuli/script/SikuliX.java
@@ -6,8 +6,6 @@
*/
package org.sikuli.script;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import org.sikuli.basics.CommandArgs;
@@ -21,7 +19,7 @@ import org.sikuli.basics.SikuliScript;
*/
public class SikuliX {
- private static final String me = "SikuliXFinal: ";
+ private static final String me = "SikuliX: ";
private static List<Region> runningObservers = new ArrayList<Region>();
public static void addRunningObserver(Region r) {
diff --git a/Basics/src/main/java/org/sikuli/basics/FileManager.java b/Basics/src/main/java/org/sikuli/basics/FileManager.java
index dcb9f21..e88eb27 100644
--- a/Basics/src/main/java/org/sikuli/basics/FileManager.java
+++ b/Basics/src/main/java/org/sikuli/basics/FileManager.java
@@ -1116,20 +1116,8 @@ public class FileManager {
out.flush();
}
- public static boolean pathEquals(String path1, String path2, boolean isFolder) {
- String p1 = new File(slashify(path1, isFolder)).getAbsolutePath();
- String p2 = new File(slashify(path2, isFolder)).getAbsolutePath();
- if (Settings.isWindows()) {
- if (p1.startsWith("/")) {
- p1 = p1.substring(1);
- }
- if (p2.startsWith("/")) {
- p2 = p2.substring(1);
- }
- p1 = p1.toUpperCase();
- p2 = p2.toUpperCase();
- }
- return p1.equals(p2);
+ public static boolean pathEquals(String path1, String path2) {
+ return (new File(path1)).equals(new File(path2));
}
}
diff --git a/Basics/src/main/java/org/sikuli/basics/RunSetup.java b/Basics/src/main/java/org/sikuli/basics/RunSetup.java
index 0b3a6e5..50c558e 100644
--- a/Basics/src/main/java/org/sikuli/basics/RunSetup.java
+++ b/Basics/src/main/java/org/sikuli/basics/RunSetup.java
@@ -32,8 +32,6 @@ public class RunSetup {
private static boolean runningUpdate = false;
private static boolean isUpdateSetup = false;
- public static String timestampBuilt;
- private static final String tsb = "##--##Mi 27 Nov 2013 15:29:45 CET##--##";
private static boolean runningfromJar = true;
private static String workDir;
private static String uhome;
@@ -42,13 +40,13 @@ public class RunSetup {
private static String majorversion = Settings.getVersionShortBasic();
private static String updateVersion;
private static String downloadBaseDirBase = "https://launchpad.net/raiman/sikulix2013+/";
- private static String downloadBaseDir = downloadBaseDirBase + majorversion + ".0/";
+ private static String downloadBaseDir = downloadBaseDirBase + majorversion + ".0/+download/";
private static String downloadSetup;
private static String downloadIDE = version + "-1.jar";
- private static String downloadMacApp = version + "-9.jar";
+ private static String downloadMacApp = version.substring(0, 5) + "-9.jar";
private static String downloadScript = version + "-2.jar";
private static String downloadJava = version + "-3.jar";
- private static String downloadTess = version + "-5.jar";
+ private static String downloadTess = version.substring(0, 5) + "-5.jar";
private static String downloadRServer = version + "-7.jar";
private static String localJava = "sikuli-java.jar";
private static String localScript = "sikuli-script.jar";
@@ -60,7 +58,7 @@ public class RunSetup {
private static String localSetup = "sikuli-setup-" + majorversion + ".jar";
private static String localUpdate = "sikuli-update";
private static String localTess = "sikuli-tessdata.jar";
- private static String localRServer = "sikulix-remoteserver.jar";
+ private static String localRServer = "sikuli-remoteserver.jar";
private static String localLogfile;
private static SetUpSelect winSU;
private static JFrame winSetup;
@@ -82,11 +80,10 @@ public class RunSetup {
private static boolean runningSetup = false;
private static boolean generallyDoUpdate = false;
+ public static String timestampBuilt;
+ private static final String tsb = "##--##Fri Jan 3 13:44:43 CET 2014##--##";
static {
- timestampBuilt = tsb.substring(6, tsb.length() - 6);
- timestampBuilt = timestampBuilt.substring(
- timestampBuilt.indexOf(" ") + 1, timestampBuilt.lastIndexOf(" "));
- timestampBuilt = timestampBuilt.replaceAll(" ", "").replaceAll(":", "").toUpperCase();
+ timestampBuilt = SikuliX.makeTimestamp(tsb);
}
//<editor-fold defaultstate="collapsed" desc="new logging concept">
@@ -120,17 +117,17 @@ public class RunSetup {
PreferencesUser prefs = PreferencesUser.getInstance();
boolean prefsHaveProxy = false;
- if (Settings.SikuliVersionBetaN > 0 && Settings.SikuliVersionBetaN < 999) {
- updateVersion = String.format("%d.%d-Beta%d",
- Settings.SikuliVersionMajor, Settings.SikuliVersionMinor,
+ if (Settings.SikuliVersionBetaN > 0 && Settings.SikuliVersionBetaN < 99) {
+ updateVersion = String.format("%d.%d.%d-Beta%d",
+ Settings.SikuliVersionMajor, Settings.SikuliVersionMinor, Settings.SikuliVersionSub,
1 + Settings.SikuliVersionBetaN);
- } else if (Settings.SikuliVersionSub > 0) {
+ } else if (Settings.SikuliVersionBetaN < 1) {
updateVersion = String.format("%d.%d.%d",
Settings.SikuliVersionMajor, Settings.SikuliVersionMinor,
1 + Settings.SikuliVersionSub);
} else {
updateVersion = String.format("%d.%d.%d",
- Settings.SikuliVersionMajor, Settings.SikuliVersionMinor, 0);
+ Settings.SikuliVersionMajor, 1 + Settings.SikuliVersionMinor, 0);
}
options.addAll(Arrays.asList(args));
@@ -905,7 +902,9 @@ public class RunSetup {
FileManager.deleteFileOrFolder(folderLibs.getAbsolutePath());
}
- folderLibs.mkdirs();
+ if (runningfromJar) {
+ folderLibs.mkdirs();
+ }
loader.check(Settings.SIKULI_LIB);
@@ -919,6 +918,7 @@ public class RunSetup {
+ "Check the error log at " + logfile);
terminate("Setting up environment did not work");
}
+
if (getJava) {
log1(lvl, "Trying to run functional test: JAVA-API");
splash = showSplash("Trying to run functional test(s)", "Java-API: org.sikuli.script.SikuliX.testSetup()");
@@ -984,6 +984,14 @@ public class RunSetup {
terminate("Functional test Jython did not work");
}
}
+
+ if (!runningfromJar) {
+ (new File(uhome, "SikuliX/libs")).renameTo(folderLibs);
+ if ((new File(uhome, "SikuliX/Lib")).exists()) {
+ (new File(uhome, "SikuliX/Lib")).renameTo(new File(workDir, "Lib"));
+ }
+ }
+
splash = showSplash("Setup seems to have ended successfully!", "Detailed information see: " + logfile);
start += 2000;
@@ -1049,6 +1057,16 @@ public class RunSetup {
log1(lvl, "restoring " + localRServer);
new File(backup, localRServer).renameTo(new File(workDir, localRServer));
}
+ String folder = "Lib";
+ if (new File(backup, folder).exists() && !new File(workDir, folder).exists()) {
+ log1(lvl, "restoring " + "folder " + folder);
+ new File(backup, folder).renameTo(new File(workDir, folder));
+ }
+ folder = "libs";
+ if (new File(backup, folder).exists() && !new File(workDir, folder).exists()) {
+ log1(lvl, "restoring " + "folder " + folder);
+ new File(backup, folder).renameTo(new File(workDir, folder));
+ }
}
private static void reset(int type) {
diff --git a/Basics/src/main/java/org/sikuli/basics/Settings.java b/Basics/src/main/java/org/sikuli/basics/Settings.java
index 32613e1..09278d0 100644
--- a/Basics/src/main/java/org/sikuli/basics/Settings.java
+++ b/Basics/src/main/java/org/sikuli/basics/Settings.java
@@ -63,8 +63,8 @@ public class Settings {
public static String[] ServerList = {"http://dl.dropboxusercontent.com/u/42895525/SikuliX"};
private static final String sversion = String.format("%d.%d.%d",
SikuliVersionMajor, SikuliVersionMinor, SikuliVersionSub);
- private static final String bversion = String.format("%d.%d-Beta%d",
- SikuliVersionMajor, SikuliVersionMinor, SikuliVersionBetaN);
+ private static final String bversion = String.format("%d.%d.%d-Beta%d",
+ SikuliVersionMajor, SikuliVersionMinor, SikuliVersionSub, SikuliVersionBetaN);
public static final String SikuliVersionDefault = "Sikuli " + sversion;
public static final String SikuliVersionBeta = "Sikuli " + bversion;
public static final String SikuliVersionDefaultIDE = "Sikuli IDE " + sversion;
@@ -74,7 +74,7 @@ public class Settings {
public static String SikuliVersion;
public static String SikuliVersionIDE;
public static String SikuliVersionScript;
- public static final String versionMonth = "November 2013";
+ public static final String versionMonth = "January 2014";
/**
@@ -106,7 +106,7 @@ public class Settings {
SikuliRepo = null;
// set the version strings
- if (SikuliVersionSub == 0 && SikuliVersionBetaN > 0) {
+ if (SikuliVersionBetaN > 0) {
SikuliVersion = SikuliVersionBeta;
SikuliVersionIDE = SikuliVersionBetaIDE;
SikuliVersionScript = SikuliVersionBetaScript;
@@ -277,7 +277,7 @@ public class Settings {
}
public static String getVersionShort() {
- if (SikuliVersionBetaN > 0) {
+ if (SikuliVersionBetaN > 0 && SikuliVersionBetaN < 99) {
return bversion;
}
else {
diff --git a/Basics/src/main/java/org/sikuli/basics/SikuliX.java b/Basics/src/main/java/org/sikuli/basics/SikuliX.java
index 354c242..8e081db 100644
--- a/Basics/src/main/java/org/sikuli/basics/SikuliX.java
+++ b/Basics/src/main/java/org/sikuli/basics/SikuliX.java
@@ -105,7 +105,7 @@ public class SikuliX {
}
return;
}
- if (args[0].contains("-testSetup") || args[0].startsWith("-i")) {
+ if (args.length > 0 && (args[0].contains("-testSetup") || args[0].startsWith("-i"))) {
start = (new Date()).getTime();
String[] splashArgs = new String[]{
"splash", "#", "#" + Settings.SikuliVersionScript, "", "#", "#... starting - please wait ..."};
@@ -471,4 +471,22 @@ public class SikuliX {
loader.doSomethingSpecial("runcmd", args);
return args[0];
}
+
+
+ /**
+ * INTERNAL USE: convert ##--##Fri Jan 3 10:53:05 CET 2014##--## <br />
+ * to: 2014-JAN-03-10:53:05 (timestamp of build)
+ * @param tsb
+ * @return
+ */
+ public static String makeTimestamp(String tsb) {
+ String timestamp = tsb.substring(6, tsb.length() - 6);
+ timestamp = timestamp.substring(timestamp.indexOf(" ") + 1);
+ timestamp = timestamp.substring(timestamp.length()-4) + "-" +
+ timestamp.substring(0, timestamp.length()-5);
+ timestamp = timestamp.substring(0, timestamp.lastIndexOf(" "));
+ timestamp = timestamp.replaceAll(" ", "-").toUpperCase();
+ timestamp = timestamp.replaceAll("--", "-0").toUpperCase();
+ return timestamp;
+ }
}
diff --git a/Basics/src/main/resources/Commands/mac/runScript b/Basics/src/main/resources/Commands/mac/runScript
index 8165d1c..f1b30d9 100755
--- a/Basics/src/main/resources/Commands/mac/runScript
+++ b/Basics/src/main/resources/Commands/mac/runScript
@@ -31,7 +31,7 @@ else
shome=`dirname $0`
fi
-if [ -e "$shome/sikuli-ide.jar" ]; then
+if [ -e "$shome/sikuli-script.jar" ]; then
export SIKULI_COMMAND=$*
echo "running SikuliX-Script: $PROPS $CONSOLE"
echo "-jar $shome/sikuli-script.jar $SIKULI_COMMAND"
diff --git a/Basics/src/main/resources/Lib/sikuli/Sikuli.py b/Basics/src/main/resources/Lib/sikuli/Sikuli.py
index df04fd1..0cefb4a 100755
--- a/Basics/src/main/resources/Lib/sikuli/Sikuli.py
+++ b/Basics/src/main/resources/Lib/sikuli/Sikuli.py
@@ -76,7 +76,7 @@ import SikuliImporter
Debug.log(3, "Jython: sikuli: Sikuli: import SikuliX")
from org.sikuli.basics import SikuliScript
-from org.sikuli.script import SikuliX
+from org.sikuli.basics import SikuliX
##
# some support for handling unicode and strings
@@ -350,7 +350,7 @@ def run(cmd):
##
# display some help in interactive mode
def shelp():
- SikuliX.shelp()
+ SikuliScript.shelp()
##
# helper functions, that can be used when sorting lists of regions
diff --git a/Jython/src/main/java/org/sikuli/scriptrunner/JythonScriptRunner.java b/Jython/src/main/java/org/sikuli/scriptrunner/JythonScriptRunner.java
index cf50451..6b4af34 100644
--- a/Jython/src/main/java/org/sikuli/scriptrunner/JythonScriptRunner.java
+++ b/Jython/src/main/java/org/sikuli/scriptrunner/JythonScriptRunner.java
@@ -40,8 +40,6 @@ public class JythonScriptRunner implements IScriptRunner {
}
//</editor-fold>
- private static String timestampBuilt;
- private static final String tsb = "##--##Sa 2 Nov 2013 14:49:40 CET##--##";
/**
* The PythonInterpreter instance
*/
@@ -95,12 +93,11 @@ public class JythonScriptRunner implements IScriptRunner {
= FileManager.convertStreamToString(SikuliBundleCleaner);
private static String sikuliLibPath;
+ private static String timestampBuilt;
+ private static final String tsb = "##--##Fri Jan 3 13:45:00 CET 2014##--##";
static {
- timestampBuilt = tsb.substring(6, tsb.length() - 6);
- timestampBuilt = timestampBuilt.substring(
- timestampBuilt.indexOf(" ") + 1, timestampBuilt.lastIndexOf(" "));
- timestampBuilt = timestampBuilt.replaceAll(" ", "").replaceAll(":", "").toUpperCase();
- Debug.log(3, "SikuliX Jython Support Build: %s %s", Settings.getVersionShort(), timestampBuilt);
+ Debug.log(3, "SikuliX Jython Support Build: %s %s", Settings.getVersionShort(),
+ SikuliX.makeTimestamp(tsb));
}
/**
@@ -118,7 +115,7 @@ public class JythonScriptRunner implements IScriptRunner {
log(lvl, "init: python.path hack: \n" + System.getProperty("python.path"));
} else {
String currentPath = System.getProperty("python.path");
- if (!FileManager.pathEquals(currentPath, sikuliLibPath, true)) {
+ if (!FileManager.pathEquals(currentPath, sikuliLibPath)) {
log(-1, "init: Not running from jar and Python path not empty: Sikuli might not work!\n"
+ "Current python.path: " + currentPath);
}
@@ -568,11 +565,11 @@ public class JythonScriptRunner implements IScriptRunner {
*/
private void executeScriptHeader(String[] syspaths) {
// TODO implement compile only
- if (syspaths[0].toUpperCase().equals(COMPILE_ONLY)) {
+ if (syspaths.length > 0 && syspaths[0].toUpperCase().equals(COMPILE_ONLY)) {
return;
}
PyList jypath = interpreter.getSystemState().path;
- if (!FileManager.pathEquals((String) jypath.get(0), sikuliLibPath, true)) {
+ if (!FileManager.pathEquals((String) jypath.get(0), sikuliLibPath)) {
log(lvl, "executeScriptHeader: adding SikuliX Lib path to sys.path\n" + sikuliLibPath);
int jypathLength = jypath.__len__();
String[] jypathNew = new String[jypathLength + 1];
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git
More information about the pkg-java-commits
mailing list