Salome HOME
Ajout de l'executable
authorAndré <andre.ribes@edf.fr>
Wed, 21 Apr 2010 14:39:34 +0000 (16:39 +0200)
committerAndré <andre.ribes@edf.fr>
Wed, 21 Apr 2010 14:39:34 +0000 (16:39 +0200)
Makefile.am
bin/DatassimYacsSchemaCreator.py [new file with mode: 0644]
bin/Makefile.am [new file with mode: 0644]
configure.ac
src/daSalome/daYacsSchemaCreator/YacsSchemaCreator.py [deleted file]
src/daSalome/daYacsSchemaCreator/run.py [new file with mode: 0644]

index e3bb26dac8a4b369a385de4af1210a03305f8c61..1aa61a8a0dd884cf66a6b4b0bc383df9ef6bc2dc 100644 (file)
@@ -1,3 +1,3 @@
 include $(top_srcdir)/adm_local/make_common_starter.am
-SUBDIRS = idl resources src
+SUBDIRS = idl resources src bin
 ACLOCAL_AMFLAGS = -I adm_local
diff --git a/bin/DatassimYacsSchemaCreator.py b/bin/DatassimYacsSchemaCreator.py
new file mode 100644 (file)
index 0000000..46e7d52
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+#-*-coding:iso-8859-1-*-
+#  Copyright (C) 2008-2009  EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# --
+# Author : André RIBES (EDF R&D)
+# --
+
+import sys
+import os
+import traceback
+import logging
+logging.basicConfig(level=logging.DEBUG, format='%(levelname)-8s %(message)s')
+
+print "-- Starting DatassimYacsSchemaCreator --"
+
+# Check some basics variables
+if "DATASSIM_ROOT_DIR" not in os.environ:
+  logging.fatal("You have to define DATASSIM_ROOT_DIR")
+  sys.exit(1)
+
+try:
+  from daYacsSchemaCreator.run import *
+  from daYacsSchemaCreator.help_methods import *
+except:
+  logging.fatal("Import of DATASSIM python modules failed !" +
+                "\n add DATASSIM python installation directory in your PYTHONPATH")
+  sys.exit(1)
+
+# Parse arguments
+from optparse import OptionParser
+usage = "usage: %prog [options] config_file yacs_schema_filename"
+version="%prog 0.1"
+my_parser = OptionParser(usage=usage, version=version)
+(options, args) = my_parser.parse_args()
+check_args(args)
+
+config_file =  args[0]
+yacs_schema_filename =  args[1]
+create_schema(config_file, yacs_schema_filename)
diff --git a/bin/Makefile.am b/bin/Makefile.am
new file mode 100644 (file)
index 0000000..a95e5c2
--- /dev/null
@@ -0,0 +1,5 @@
+include $(top_srcdir)/adm_local/make_common_starter.am
+
+bin_SCRIPTS = DatassimYacsSchemaCreator.py
+
+EXTRA_DIST = DatassimYacsSchemaCreator.py
index 53b02b0abdeb74e3fd649c8d91c510eba541eb7b..5f48ce902274f3caf9e24374917a3999d32927e1 100644 (file)
@@ -73,5 +73,6 @@ AC_CONFIG_FILES([
         src/Makefile
         src/daComposant/Makefile
         src/daSalome/Makefile
+        bin/Makefile
         ])
 AC_OUTPUT
diff --git a/src/daSalome/daYacsSchemaCreator/YacsSchemaCreator.py b/src/daSalome/daYacsSchemaCreator/YacsSchemaCreator.py
deleted file mode 100755 (executable)
index cb78d76..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/python
-#-*-coding:iso-8859-1-*-
-#  Copyright (C) 2008-2009  EDF R&D
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# --
-# Author : André RIBES (EDF R&D)
-# --
-
-import sys
-import os
-import traceback
-import logging
-from optparse import OptionParser
-from daYacsSchemaCreator.methods import *
-from daYacsSchemaCreator.help_methods import *
-
-# Variables globales
-global my_parser
-
-# Init part
-def init():
-
-  logging.basicConfig(level=logging.DEBUG, format='%(levelname)-8s %(message)s')
-  usage = "usage: %prog [options] config_file yacs_schema_filename"
-  version="%prog 0.1"
-  global my_parser
-  my_parser = OptionParser(usage=usage, version=version)
-
-# Start application
-def main():
-
-  print "-- Starting YacsSchemaCreator --"
-  (options, args) = my_parser.parse_args()
-  check_args(args)
-  config_file =  args[0]
-  yacs_schema_filename =  args[1]
-
-  # Import config_file
-  try:
-    execfile(config_file)
-  except:
-    logging.fatal("Exception in loading " + config_file)
-    traceback.print_exc()
-    sys.exit(1)
-
-  if "study_config" not in locals():
-    logging.fatal("Cannot found study_config in " + str(config_file))
-    sys.exit(1)
-  else:
-    globals()['study_config'] = locals()['study_config']
-
-  if "DATASSIM_ROOT_DIR" not in os.environ:
-    logging.fatal("You have to define DATASSIM_ROOT_DIR")
-    sys.exit(1)
-
-  check_study(study_config)
-  proc = create_yacs_proc(study_config)
-  write_yacs_proc(proc, yacs_schema_filename)
-
-init()
-main()
diff --git a/src/daSalome/daYacsSchemaCreator/run.py b/src/daSalome/daYacsSchemaCreator/run.py
new file mode 100644 (file)
index 0000000..e761892
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+#-*-coding:iso-8859-1-*-
+#  Copyright (C) 2008-2009  EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# --
+# Author : André RIBES (EDF R&D)
+# --
+
+import sys
+import os
+import traceback
+import logging
+from optparse import OptionParser
+from daYacsSchemaCreator.methods import *
+from daYacsSchemaCreator.help_methods import *
+
+def create_schema(config_file, yacs_schema_filename):
+
+  # Import config_file
+  try:
+    execfile(config_file)
+  except:
+    logging.fatal("Exception in loading " + config_file)
+    traceback.print_exc()
+    sys.exit(1)
+
+  if "study_config" not in locals():
+    logging.fatal("Cannot found study_config in " + str(config_file))
+    sys.exit(1)
+  else:
+    globals()['study_config'] = locals()['study_config']
+
+  check_study(study_config)
+  proc = create_yacs_proc(study_config)
+  write_yacs_proc(proc, yacs_schema_filename)