6Jenkins Test Server script.
8@note: Start build jobs on the Jenkins Test Server using PyXMake.
11----------------------------------------------------------------------------------------------
19 - hein_fa [DLR-FA,STM Braunschweig]
20 - garb_ma [DLR-FA,STM Braunschweig]
21----------------------------------------------------------------------------------------------
36from main import release creator_Abhi
46from packaging.version
import parse
47from distutils.command
import clean
as _clean
48from distutils
import core
51if os.path.abspath(inspect.getfile(inspect.currentframe())).split(
"PyXMake")[0]
not in sys.path:
52 sys.path.append(os.path.abspath(inspect.getfile(inspect.currentframe())).split(
"PyXMake")[0])
56 Little clean extension: Cleans up a non-empty build directory.
60 Delete all redundant folders and directories. Ignore read-only GIT repositories
65 for path
in [
"build",
"dist",
".coverage"]:
66 if os.path.isdir(path):
67 try: DeleteRedundantFolders(path, ignore_readonly=
True)
68 except: shutil.rmtree(path)
69 elif os.path.isfile(path):
75 Base class for encapsulating command line commands.
84 def _create_build_dir():
85 if not os.path.exists(
"build"):
88 def _create_command(self):
91 def _run_command(self, command):
94 subprocess.call(command, shell=
True)
96 def _perform_post_actions(self):
100class pyx_app(_BaseCommandRunner):
102 Base class for encapsulating command line arguments and build process.
107 description =
"Compile a stand-alone application using PyInstaller."
110 (
'source-path=',
None,
'path to the folder holding source files'),
111 (
'verbose=',
None,
'controls the logging level (0 - Nothing, 2- Everything) Default: 0 - Nothing'),
112 (
'mode=',
None,
'define application build mode (one directory or one file mode)'),
113 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
114 (
'output-file-path=',
None,
'path to the output directory'),
119 Set default values for options.
132 Post-process options.
140 Execute build command
142 from PyXMake.VTL
import app
145 include = []; dependency = []
160 include=include, dependency=dependency,
161 preprocessing=command)
165 Runs the application build process using PyCODAC to create runtime for STMLab.
167 from PyXMake.VTL
import GetSourceCode
174 def _create_command(self):
175 from PyXMake
import VTL
183 delimn =
" "; continuation =
"&&"
184 command = delimn.join([
185 sys.executable,os.path.join(PyCODAC.PyCODACPath,
"Plugin",
"DELiS",
"__install__.py"),continuation,
186 sys.executable,os.path.join(PyCODAC.PyCODACPath,
"Plugin",
"DELiS",
"__update__.py"),continuation,
187 sys.executable,os.path.join(PyCODAC.PyCODACPath,
"Plugin",
"Smetana",
"__install__.py"),continuation,
188 sys.executable,os.path.join(PyCODAC.PyCODACPath,
"Plugin",
"Smetana",
"__update__.py")
196 Base class for encapsulating command line arguments and build process.
201 description =
"Compile a stand-alone installer using NSIS."
204 (
'source-path=',
None,
'path to the folder holding source files'),
205 (
'verbose=',
None,
'controls the logging level (0 - Nothing, 2- Everything) Default: 0 - Nothing'),
206 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
207 (
'output-file-path=',
None,
'path to the output directory'),
208 (
'install-path=',
None,
'path to the default installation directory'),
213 Set default values for options.
224 Post-process options.
232 Execute build command
234 from PyXMake.VTL
import bundle
246 user=
'ASRI_adm', key=
'lm9ITHUR', upload =
True)
250 Create an installer for STMLab using PyCODAC.
253 _BUNDLE_NAME =
'STMLab'
256 def _create_command(self):
261 self.
install_pathinstall_path = os.getenv(
"plugin_central_dir",os.path.join(Utility.AsDrive(
"c"),
"simulia",
"cae",
"plugins",
"2019"))
264 __pyc_plugin = os.path.join(self.
source_path,
"PyCODAC")
265 __smet_plugin = os.path.join(self.
source_path,
"Smetana")
267 __pyc_plugin_repo = __url_delimn.join([
"https:",
"",
"svn.dlr.de",
"STM-Routines",
"Analysis_Tools",
"MCODAC",
"trunk",
"src",
"mcd_pycodac",
"PyCODAC",
"Plugin",
"JupyterLab",
"src"])
268 __smet_plugin_repo = __url_delimn.join([
"https:",
"",
"svn.dlr.de",
"STM-Routines",
"Analysis_Tools",
"MCODAC",
"trunk",
"src",
"mcd_pycodac",
"PyCODAC",
"Plugin",
"Smetana",
"src"])
271 if "@" in __pyc_plugin: __pyc_plugin +=
"@"
272 if "@" in __smet_plugin: __smet_plugin +=
"@"
273 svn.remote.RemoteClient(__pyc_plugin_repo).export(__pyc_plugin, force=
True)
274 svn.remote.RemoteClient(__smet_plugin_repo).export(__smet_plugin, force=
True)
276 if __pyc_plugin.endswith(
"@"): __pyc_plugin = __pyc_plugin[:-1]
278 shutil.rmtree(os.path.join(__pyc_plugin,
".config"), ignore_errors=
True)
279 os.remove(os.path.join(__pyc_plugin,
"user",
"Paths.log"))
288 Base class for encapsulating command line arguments and build process.
293 description =
"Runs the html documentation build process of source code using Sphinx."
296 (
'source-path=',
None,
'path to the folder holding source files'),
297 (
'verbose=',
None,
'controls the logging level (0 - Nothing, 2- Everything) Default: 0 - Nothing'),
298 (
'include-path=',
None,
'path to additional files required for processing.'),
299 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
300 (
'output-file-path=',
None,
'path to the output directory'),
301 (
'logo=',
None,
'Custom logo for the upper left corner. Defaults to None, leaving the space empty'),
306 Set default values for options.
318 Post-process options.
326 Execute build command
328 from PyXMake.VTL
import sphinx
342 Runs the html documentation build process for Structural Mechanics Lab using a scheme from ReadtheDocs.
345 _BUILD_NAME =
'Structural Mechanics Lab'
346 _INPUT_FILE =
"stm_lab"
348 def _create_command(self):
351 __arch = Utility.GetArchitecture()
352 __platform = Utility.GetPlatform()
354 from PyCODAC.Tools.Utility
import GetPyCODACPath
356 __pyc_core_path = GetPyCODACPath()
359 os.path.join(__pyc_core_path,
"Plugin",
"Smetana",
"src",
"Smetana"),
360 os.path.join(__pyc_core_path,
"Core",
"bin",__platform,__arch)]
361 self.
logologo = os.path.join(__pyc_core_path,
"VTL",
"doc",
"mcd_stmlab",
"pics",
"stm_lab_logo_bubbles.png")
369 Base class for encapsulating command line arguments and build process.
374 description =
"Runs the html documentation build process of source code using Doxygen."
377 (
'source-path=',
None,
'path to the folder holding source files'),
378 (
'verbose=',
None,
'controls the logging level (0 - Nothing, 2- Everything) Default: 0 - Nothing'),
379 (
'stype=',
None,
'define type of source files (Java, Python or left blank) Defaults to: Fortran'),
380 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
381 (
'output-file-path=',
None,
'path to the output directory'),
386 Set default values for options.
392 self.
stype =
"Fortran"
397 Post-process options.
405 Execute build command
407 from PyXMake.VTL
import doxygen
415 title=[self.brief, self.header],
425 del os.environ[
'dox_hue']; del os.environ[
'dox_sat']; os.environ[
'dox_gamma']
430 Runs the html documentation build process for PyXMake.
433 _BUILD_NAME =
'pyx_core'
444 def _create_command(self):
449 self.
brief =
"PyXMake"
450 self.
header =
"PyXMake Developer Guide"
456 Runs the html documentation build process for PyCODAC.
459 _BUILD_NAME =
'pyc_core'
461 def _create_command(self):
465 contains=(
"DELiS",
"Smetana",
"PyXMake",
"external",
"doc",
"cmd",
"bin",
"include",
"lib",
"config",
"fetch"),
466 endswith=(
"VTL",
"make",
"scratch",
"examples",
"src",
"config",
"solver"))]
468 self.
brief =
"PyCODAC"
469 self.
header =
"PyCODAC Developer Guide"
475 Runs the html documentation build process for BoxBeam.
477 from PyXMake.VTL
import GetSourceCode
480 _BUILD_NAME =
'box_main'
484 def _create_command(self):
485 self.
brief =
"BoxBeam"
486 self.
header =
"BoxBeam Developer Guide"
492 Runs the html documentation build process for MCODAC.
494 from PyXMake.VTL
import GetSourceCode
497 _BUILD_NAME =
'mcd_core'
501 def _create_command(self):
502 self.
brief =
"MCODAC"
503 self.
header =
"MCODAC Developer Guide"
509 Runs the html documentation build process for BoxBeam.
511 _BUILD_NAME =
'mcd_subbuck'
513 def _create_command(self):
514 self.
brief =
"SubBuck"
515 self.
header =
"SubLaminate Buckling Developer Guide"
521 Runs the html documentation build process for BoxBeam.
523 _BUILD_NAME =
'mcd_mapper'
525 def _create_command(self):
526 self.
brief =
"Mapper"
527 self.
header =
"Damage Mapping Developer Guide"
534 Base class for encapsulating command line arguments and build process.
539 description =
"Runs the build process of Fortran source code for Python using f2py."
542 (
'msvsc=',
None,
'identifier, which compiler version from Microsoft Visual Studio to be used'),
543 (
'source-path=',
None,
'path to the folder holding the fortran files'),
544 (
'verbose=',
None,
'controls the logging level (0 - Nothing) Default: 2 - Everything'),
545 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
546 (
'output-file-path=',
None,
'path to the output directory'),
547 (
'base-path=',
None,
'path to base folder - optional'),
552 Set default values for options.
555 self.
_MAKE_OPT = {
"Python":0,
"Java":1,
"Fortran":2}
567 if sys.getwindowsversion() >= (10, 0, 0):
569 self.
msvsc =
"vs2015"
572 self.
msvsc =
"vs2010"
576 Post-process options.
580 'Source path for Fortran files '+self.
source_path+
' does not exist.')
583 'Path to base folder '+self.
base_path+
' does not exist.')
587 Execute build command
590 from PyXMake.VTL
import py2x
593 includes = []; libs = []; libpaths = []
605 libs=libs,include=includes,dependency=libpaths,
613 Runs the build process for MCODAC.
615 from PyXMake.VTL
import GetSourceCode
618 _PACKAGE_NAME =
'mcd_core'
622 def _create_command(self):
623 from PyXMake
import VTL
627 for x
in VTL.GetIncludeDirectory(self.
base_path, 0, 4, Utility.GetArchitecture())],
631 return VTL.GetBuildCommand(self.
_MAKE_OPT[
"Python"])
635 Runs the build process for BoxBeam.
637 from PyXMake.VTL
import GetSourceCode
640 _PACKAGE_NAME =
'bbeam'
644 def _create_command(self):
645 from PyXMake.VTL
import GetBuildCommand
650 Runs the build process for Beos.
652 _PACKAGE_NAME =
'beos'
655 from PyXMake.VTL
import GetSourceCode
658 def _create_command(self):
659 from PyXMake.VTL
import GetBuildCommand
666 Base class for encapsulating command line arguments and build process.
671 description =
"Runs the build process of Fortran source code using the Intel Fortran Compiler through Python."
674 (
'source-path=',
None,
'path to the folder holding the fortran files'),
675 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
676 (
'output-file-path=',
None,
'path to the output directory'),
677 (
'base-path=',
None,
'path to base folder - optional'),
678 (
'verbose=',
None,
'controls the logging level (0 - Nothing) Default: 2 - Everything'),
679 (
'btype=',
None,
'controls the building type. Defaults to static library. Use shared to indicate a dynamic library shall be created'),
684 Set default values for options.
687 self.
_MAKE_OPT = {
"Python":0,
"Java":1,
"Fortran":2}
693 self.
btype =
'static'
701 Post-process options.
705 'Source path for Fortran files '+self.
source_path+
' does not exist.')
708 'Path to base folder '+self.
base_path+
' does not exist.')
712 Execute build command
715 from PyXMake.VTL
import ifort
718 includes = []; libs = []; libpaths = []
745 Runs the build process for MCODAC.
747 from PyXMake.VTL
import GetSourceCode
749 _PACKAGE_NAME =
'mcd_java'
753 def _create_command(self):
754 from PyXMake
import VTL
758 for x
in VTL.GetIncludeDirectory(self.
base_path, 0, 4, Utility.GetArchitecture())],
762 return VTL.GetBuildCommand(self.
_MAKE_OPT[
"Java"])
766 Runs the build process for BoxBeam.
768 from PyXMake.VTL
import GetSourceCode
771 _PACKAGE_NAME =
'bbeam_java'
775 def _create_command(self):
776 from PyXMake
import VTL
783 return VTL.GetBuildCommand(self.
_MAKE_OPT[
"Java"])
787 Runs the build process for MCODAC on Windows.
789 from PyXMake.VTL
import GetSourceCode
792 _PACKAGE_NAME =
'mcd_core'
796 def _create_command(self):
797 from PyXMake
import VTL
801 for x
in VTL.GetIncludeDirectory(self.
base_path, 0, 4, Utility.GetArchitecture())],
806 return VTL.GetBuildCommand(self.
_MAKE_OPT[
"Fortran"])
810 Runs the build process for BoxBeam on Windows.
812 from PyXMake.VTL
import GetSourceCode
815 _PACKAGE_NAME =
'bbeam'
819 def _create_command(self):
820 from PyXMake
import VTL
828 return VTL.GetBuildCommand(self.
_MAKE_OPT[
"Fortran"])
832 Base class for encapsulating command line arguments and build process.
837 description =
"Runs an user-defined build process utilizing the PyXMake build environment."
840 (
'msvsc=',
None,
'identifier, which compiler version from Microsoft Visual Studio to be used'),
841 (
'source-path=',
None,
'path to the folder holding source files'),
842 (
'source-file=',
None,
'source file or list of source files. Defaults to "mcd_astandard"'),
843 (
'verbose=',
None,
'controls the logging level (0 - Nothing) Default: 2 - Everything'),
844 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
845 (
'base-path=',
None,
'path to base folder - optional'),
846 (
'output-file-path=',
None,
'path to the output directory'),
851 Set default values for options.
865 if sys.getwindowsversion() >= (10, 0, 0):
867 self.
msvsc =
"vs2015"
870 self.
msvsc =
"vs2010"
874 Post-process options.
878 'Source path to build files '+self.
source_path+
' does not exist.')
881 'Path to base folder '+self.
base_path+
' does not exist.')
885 Execute build command
893 CBuild.Preprocessing(
'fpp /P /e', inend=
'.f', outend=
'.for')
894 CBuild.Build(command)
896 CBuild.AddIncludePath(self.
includes)
898 CBuild.AddDependencyPath(self.
libpaths)
900 CBuild.UseLibraries(self.
libs)
905 Runs the build process of MCODAC for ABAQUS.
908 _PACKAGE_NAME =
'mcd_abaqus'
911 def _create_command(self):
912 from PyXMake
import VTL
916 if (sys.version_info < (3, 0)):
917 raise NotImplementedError
919 elif (sys.version_info > (3, 0)):
920 self.
copyfiles = [
"standardU.dll",
"explicitU-D.dll"]
923 for x
in VTL.GetIncludeDirectory(self.
base_pathbase_path, 0, 4, Utility.GetArchitecture())]
927 return VTL.GetBuildCommand(self.
_MAKE_OPT)
932 Runs the pylint command.
934 _PACKAGE_NAME =
"src"
936 description =
"Runs the pylint command."
938 (
"command=",
None,
"Path and name of the command line tool."),
939 (
"out=",
None,
"Specifies the output type (html, parseable). Default: html")]
941 def initialize_options(self):
946 def finalize_options(self):
948 if self.
out ==
"parseable":
951 def _create_command(self):
953 "{0} --rcfile=dev/pylintrc --output-format=parseable src > {3}".
956 def _perform_post_actions(self):
957 if self.
out ==
"parseable":
960 for line
in file_object.readlines():
961 line = line.replace(
"\\",
"/")
962 new_content.append(line)
964 file_object.writelines(new_content)
969 Base class for all test classes
971 description =
"Runs all unit tests using py.test."
973 (
"command=",
None,
"Path and name of the command line tool."),
974 (
"out=",
None,
"Specifies the output format of the test results." \
975 +
"Formats: xml, standard out. Default: standard out."),
976 (
"covout=",
None,
"Specifies the output format of the coverage report." \
977 +
"Formats: xml, html.")]
979 def initialize_options(self):
984 def finalize_options(self):
991 def _create_command(self):
994 options =
"--junitxml=build/xunit.xml test"
995 if not self.
covout is None:
997 "--cov=src --cov-report={0} --cov-config=dev/coveragerc {1}".format(self.
covout, options))
998 return "py.test --cov=src --cov-report=xml --cov-config=dev/coveragerc --junitxml=build/xunit.xml test -m \"not long and not indevelopment\""
1002 Base class for encapsulating pytest commands.
1006 description =
"Run predefined unit tests using Pytest."
1009 (
'output-file-path=',
None,
'path to the output directory'),
1010 (
'source-path=',
None,
'path to the folder holding source files'),
1011 (
'scratch-path=',
None,
'path to scratch folder where all temporary data is located during the build event'),
1012 (
'verbose=',
None,
'controls the logging level (0 - Nothing, 2- Everything) Default: 0 - Nothing'),
1017 Set default values for all options.
1028 Execute test command
1032 _ = command ; include = [] ;
1034 if not include: include = self.
include
1038 if include: Coverage.AddIncludePath(include);
1043 Runs the test command for PyXMake using PyTest.
1045 _PACKAGE_NAME =
'PyXMake'
1047 def _create_command(self):
1059 Runs all unit tests.
1061 def _create_command(self):
1064 options =
"--junitxml=build/xunit.xml test"
1065 if not self.
covout is None:
1067 "--cov=src --cov-report={0} --cov-config=dev/coveragerc {1}".format(self.
covout, options))
1068 return "py.test test --junitxml=build/xunit.xml -s -m \"indevelopment\""
1073 Runs all unit tests.
1075 def _create_command(self):
1078 options =
"--junitxml=build/xunit.xml test"
1079 if not self.
covout is None:
1081 "--cov=src --cov-report={0} --cov-config=dev/coveragerc {1}".format(self.
covout, options))
1082 return "py.test --cov=src --cov-report=xml --cov-config=dev/coveragerc --junitxml=build/xunit.xml test -s"
1085def _perform_setup():
1090def _set_pythonpath():
1092 python_path = os.pathsep.join(python_path) + os.pathsep + os.environ.get(
"PYTHONPATH",
"")
1093 os.environ[
"PYTHONPATH"] = python_path
1101 if os.path.exists(
'test/__pycache__'):
1102 shutil.rmtree(
'test/__pycache__')
1105 if parse(setuptools.__version__) > parse(
"42.0.0"):
1106 attributes.update({
"license_files" : (
'LICENSE*',
"LICENSE")})
1107 warnings.filterwarnings(
"ignore")
1112 cmdclass={
"clean": Clean,
1113 "doxy_pyxmake": doxy_pyxmake,
1114 "doxy_boxbeam": doxy_boxbeam,
1115 "doxy_mcdcore": doxy_mcdcore,
1116 "doxy_mcdpycodac": doxy_mcdpycodac,
1117 "doxy_mcdmapper": doxy_mcdmapper,
1118 "doxy_mcdsubbuck": doxy_mcdsubbuck,
1119 "sphinx_stmlab": sphinx_stmlab,
1120 "f2py_beos": f2py_beos,
1121 "f2py_boxbeam": f2py_boxbeam,
1122 "f2py_mcodac": f2py_mcodac,
1123 "java_boxbeam": java_boxbeam,
1124 "java_mcodac": java_mcodac,
1125 "win_boxbeam": win_boxbeam,
1126 "win_mcodac": win_mcodac,
1127 "abq_mcodac": abq_mcodac,
1128 "app_pycodac": app_pycodac,
1129 "bundle_pycodac": bundle_pycodac,
1131 "longtest": LongTest,
1132 "indevelopmenttest": InDevelopmentTest,
1133 "pytest_pyxmake": pytest_pyxmake,
1136 author=
"Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR)",
1137 author_email=
"marc.garbade@dlr.de",
1138 maintainer=
"Deutsches Zentrum fuer Luft- und Raumfahrt e.V. (DLR)",
1139 maintainer_email=
"marc.garbade@dlr.de",
1140 license=
"Copyright DLR",
1141 platforms=[
"Linux",
"Unix",
"Windows"],
1142 packages=setuptools.find_packages(
"src"),
1143 include_package_data=
True,
1144 package_dir={
"" :
"src"},
1147 "version": (
"test.py", version),
1148 "release": (
"test.py", version)}},
1153if __name__ ==
"__main__":
_run_command(self, command)
_perform_post_actions(self)
Add PyXMake source folder to system path (if not already present).
self.source_path source_path
_run_command(self, command)
_run_command(self, command)
_run_command(self, command)
_run_command(self, command)
_run_command(self, command)
_run_command(self, command)
_run_command(self, command)
_run_command(self, command)
Create a make object to define the building environment.
Module containing all relevant modules and scripts associated with the building process.
GetBuildCommand(make_opt=0, _format="fixed", _arch=Utility.GetArchitecture())