10 from __future__
import with_statement
12 __version__ =
"$Revision: 795362 $"
13 __author__ =
"Will Buttinger"
14 __doc__ =
"streamline and ease the creation of new AthAnalysisAlgorithm in a new package"
20 import PyUtils.acmdlib
as acmdlib
26 name=
'cmake.new-skeleton'
30 help=
"name of the new pkg"
35 """create a new skeleton package
38 $ acmd cmake new-skeleton MyPackage
42 full_pkg_name = args.pkgname
45 res = subprocess.getstatusoutput(
'acmd cmake new-pkg %s' % full_pkg_name)
47 print(
"::: ERROR could not create new package")
52 res = subprocess.getstatusoutput(
'cd %s;acmd cmake new-analysisalg --newJobo %sAlg' % (full_pkg_name,full_pkg_name))
54 print(
"::: ERROR could not create new alg")
57 pkg_name = full_pkg_name
60 with open(os.path.join(full_pkg_name,
'CMakeLists.txt'),
'w')
as req:
61 print(textwrap.dedent(
"""\
62 ## automatically generated CMakeLists.txt file
65 atlas_subdir( %(pkg_name)s )
67 # Declare external dependencies ... default here is to include ROOT
68 find_package( ROOT COMPONENTS MathCore RIO Core Tree Hist )
70 # Declare package as a library
71 # Note the convention that library names get "Lib" suffix
72 # Any package you depend on you should add
73 # to LINK_LIBRARIES line below (see the example)
74 atlas_add_library( %(pkg_name)sLib src/*.cxx
75 PUBLIC_HEADERS %(pkg_name)s
76 INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
77 LINK_LIBRARIES ${ROOT_LIBRARIES}
78 AthAnalysisBaseCompsLib
81 # if you add athena components (tools, algorithms) to this package
82 # these lines are needed so you can configure them in joboptions
83 atlas_add_component( %(pkg_name)s src/components/*.cxx
85 LINK_LIBRARIES %(pkg_name)sLib
88 # if you add an application (exe) to this package
89 # declare it like this (note convention that apps go in the util dir)
90 # atlas_add_executable( MyApp util/myApp.cxx
91 # LINK_LIBRARIES %(pkg_name)sLib
94 # Install python modules, joboptions, and share content
95 atlas_install_python_modules( python/*.py )
96 atlas_install_joboptions( share/*.py )
97 atlas_install_data( data/* )
98 atlas_install_scripts( scripts/* )
99 # You can access your data from code using path resolver, e.g.
100 # PathResolverFindCalibFile("%(pkg_name)s/file.txt")
103 """%locals()), file=req)