8 from distutils
import core
9 from distutils
import cmd
10 from distutils
import log
11 from distutils
import util
12 from distutils
import dir_util
13 from distutils
import errors
14 from distutils
import version
15 from distutils.command.build
import build
16 from distutils.command.sdist
import sdist
17 from distutils.command.install
import install
18 from distutils.command.install_data
import install_data
29 if sys.version_info[0:3] >= (2, 6, 0):
30 example_sitedir = os.path.join(
"share",
"OpenRTM-aist",
"examples",
"python")
31 elif sys.version_info[0:3] >= (2, 2, 0):
32 example_sitedir = os.path.join(
"share",
"OpenRTM-aist",
"examples",
"python")
34 example_sitedir = os.path.join(
"lib",
"site-packages")
38 example_sitedir = os.path.join(
"lib",
"site-packages")
40 if sys.version_info[0:3] >= (2, 2, 0):
41 example_sitedir = os.path.join(
"lib",
"site-packages")
43 example_sitedir = os.path.join(
"lib",
"site-packages")
47 Put together command line for python stubs generation. 50 cmdline = cmd +
' '+ string.join(pars) +
' '+string.join(files)
56 status, output = commands.getstatusoutput(cmdline)
59 raise errors.DistutilsExecError(
"Return status of %s is %d" %
65 Generate name of idl file from directory prefix and IDL module name. 67 full_name =
'"'+os.path.join(dir, name +
".idl")+
'"' 73 This class realizes a subcommand of build command and is used for building 77 description =
"Generate python stubs from IDL files" 79 user_options = [(
"omniidl=",
"i",
"omniidl program used to build stubs"),
80 (
"idldir=",
"d",
"directory where IDL files reside")]
91 self.
idldir = os.path.join(os.getcwd(),
"OpenRTM_aist",
"RTM_IDL")
97 modules = [
"BasicDataType",
"DataPort",
"ExtendedDataTypes",
98 "InterfaceDataTypes",
"Manager",
"OpenRTM",
"RTC",
100 util.execute(compile_idl,
103 "Generating python stubs from IDL files")
106 self.
idldir = os.path.join(os.getcwd(),
"OpenRTM_aist",
"examples",
"SimpleService")
109 modules = [
"MyService"]
110 util.execute(compile_idl,
113 "Generating python sample stubs from IDL files")
116 self.
idldir = os.path.join(os.getcwd(),
"OpenRTM_aist",
"examples",
"AutoTest")
119 modules = [
"AutoTestService"]
120 util.execute(compile_idl,
123 "Generating python sample stubs from IDL files")
128 This class realizes a subcommand of build command and is used for building 132 description =
"Generate python stubs from IDL files in examples" 134 user_options = [(
"omniidl=",
"i",
"omniidl program used to build stubs"),
135 (
"idldir=",
"d",
"directory where IDL files reside")]
146 self.
idldir = os.path.join(os.getcwd(),
"OpenRTM_aist",
"examples",
"SimpleService")
152 modules = [
"MyService"]
154 util.execute(compile_idl,
157 "Generating python sample stubs from IDL files")
162 This class realizes a subcommand of build command and is used for building 166 description =
"Generate document by doxygen" 178 if g_os ==
"unix" and not is_examples:
179 curr_dir = os.getcwd()
180 docs_dir = os.path.join(os.getcwd(),
'OpenRTM_aist',
'docs')
188 This is here just to override default sub_commands list of build class. 189 We added 'build_examples_idl' item. 206 sub_commands = [(
'build_examples_idl', has_idl_files),
207 (
'build_py', has_pure_modules),
208 (
'build_clib', has_c_libraries),
209 (
'build_ext', has_ext_modules),
210 (
'build_scripts', has_scripts)]
215 This is here just to override default sub_commands list of build class. 216 We added 'build_idl' item. 236 sub_commands = [(
'build_doc', has_doc_files),
237 (
'build_idl', has_idl_files),
238 (
'build_py', has_pure_modules),
239 (
'build_clib', has_c_libraries),
240 (
'build_ext', has_ext_modules),
241 (
'build_scripts', has_scripts)]
249 sdist.initialize_options(self)
254 stub_dirs = [
"SimpleService",
"SimpleService__POA"]
256 for dir_
in stub_dirs:
257 if not os.path.isdir(os.path.join(os.getcwd(),
"OpenRTM_aist",
"examples",
"SimpleService",dir_)):
258 os.mkdir(os.path.join(os.getcwd(),
"OpenRTM_aist",
"examples",
"SimpleService",dir_))
262 stub_dirs = [
"OpenRTM",
"OpenRTM__POA",
265 "SDOPackage",
"SDOPackage__POA"]
267 for dir_
in stub_dirs:
268 if not os.path.isdir(os.path.join(os.getcwd(),
"OpenRTM_aist",
"RTM_IDL",dir_)):
269 os.mkdir(os.path.join(os.getcwd(),
"OpenRTM_aist",
"RTM_IDL",dir_))
272 """Create the source distribution(s). First, we create the release 273 tree with 'make_release_tree()'; then, we create all required 274 archive files (according to 'self.formats') from the release tree. 275 Finally, we clean up by blowing away the release tree (unless 276 'self.keep_temp' is true). The list of archive files created is 277 stored so it can be retrieved later by 'get_archive_files()'. 284 base_dir = self.distribution.get_fullname()
285 base_name = os.path.join(self.dist_dir, base_dir)
287 self.make_release_tree(base_dir, self.filelist.files)
291 curr_dir = os.getcwd()
292 cmd_dir = os.path.join(os.getcwd(), pkg_name+
'-'+pkg_version)
294 cmd_ =
"find . -name \"*\" | xargs qkc %s" % g_qkc_option
298 for fmt
in self.formats:
299 file = self.make_archive(base_name, fmt, base_dir=base_dir)
300 archive_files.append(file)
301 self.distribution.dist_files.append((
'sdist',
'', file))
305 if not self.keep_temp:
306 dir_util.remove_tree(base_dir, dry_run=self.dry_run)
309 install_data_dir =
None 313 global install_data_dir
314 install_data_dir = self.install_purelib
319 global install_data_dir
320 for i
in range(len(self.data_files)):
321 dir = os.path.join(install_data_dir,self.data_files[i][0])
322 self.data_files[i] = (dir,self.data_files[i][1])
323 install_data.run(self)
329 unix_packages = [
"OpenRTM_aist",
330 "OpenRTM_aist.RTM_IDL",
331 "OpenRTM_aist.RTM_IDL.OpenRTM",
332 "OpenRTM_aist.RTM_IDL.OpenRTM__POA",
333 "OpenRTM_aist.RTM_IDL.RTC",
334 "OpenRTM_aist.RTM_IDL.RTC__POA",
335 "OpenRTM_aist.RTM_IDL.RTM",
336 "OpenRTM_aist.RTM_IDL.RTM__POA",
337 "OpenRTM_aist.RTM_IDL.SDOPackage",
338 "OpenRTM_aist.RTM_IDL.SDOPackage__POA",
339 "OpenRTM_aist.RTM_IDL.device_interfaces",
341 "OpenRTM_aist.ext.sdo",
342 "OpenRTM_aist.ext.sdo.observer",
343 "OpenRTM_aist.utils",
344 "OpenRTM_aist.utils.rtcd",
345 "OpenRTM_aist.utils.rtcprof",
346 "OpenRTM_aist.utils.rtc-template",
347 "OpenRTM_aist.utils.rtm-naming"]
349 example_dir = [
"AutoControl",
357 {
"SimpleService":[
"SimpleService",
"SimpleService__POA"]},
362 example_data_files = []
364 simpleservice_path = glob.glob(os.path.join(
"OpenRTM_aist",
"examples",
"SimpleService"))[0]
365 simpleservice_path +=
"/SimpleService/__init__.py" 366 example_data_files.append((os.path.join(example_sitedir,
"SimpleService",
"SimpleService"),
367 [simpleservice_path]))
369 simpleservice__poa_path = glob.glob(os.path.join(
"OpenRTM_aist",
"examples",
"SimpleService"))[0]
370 simpleservice__poa_path +=
"/SimpleService__POA/__init__.py" 371 example_data_files.append((os.path.join(example_sitedir,
"SimpleService",
"SimpleService__POA"),
372 [simpleservice__poa_path]))
374 simpleservice_idl_path = glob.glob(os.path.join(
"OpenRTM_aist",
"examples",
"SimpleService"))[0]
375 simpleservice_idl_path +=
"/MyService_idl.py" 376 example_data_files.append((os.path.join(example_sitedir,
"SimpleService"),
377 [simpleservice_idl_path]))
379 for ex
in example_dir:
380 if isinstance(ex, str):
381 py_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples", ex,
"*.py"))
382 conf_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples", ex,
"*.conf"))
383 idl_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples", ex,
"*.idl"))
386 example_data_files.append((os.path.join(example_sitedir, ex), [pp_]))
389 for cp_
in conf_path_:
390 example_data_files.append((os.path.join(example_sitedir, ex), [cp_]))
393 for ip_
in idl_path_:
394 example_data_files.append((os.path.join(example_sitedir, ex), [ip_]))
396 elif isinstance(ex, dict):
399 if isinstance(vals_, list):
400 if isinstance(vals_[0], list):
401 for val_
in vals_[0]:
402 stub_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples",
405 for sp_
in stub_path_:
406 example_data_files.append((os.path.join(example_sitedir, key_, val_), [sp_]))
407 elif isinstance(vals_[0], str):
408 stub_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples",
409 key_, vals_[0],
"*.py"))
411 for sp_
in stub_path_:
412 example_data_files.append((os.path.join(example_sitedir, key_, vals_[0]), [sp_]))
414 py_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples", key_,
"*.py"))
415 conf_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples", key_,
"*.conf"))
416 idl_path_ = glob.glob(os.path.join(
"OpenRTM_aist",
"examples", key_,
"*.idl"))
420 example_data_files.append((os.path.join(example_sitedir, key_), [pp_]))
422 for cp_
in conf_path_:
423 example_data_files.append((os.path.join(example_sitedir, key_), [cp_]))
425 for ip_
in idl_path_:
426 example_data_files.append((os.path.join(example_sitedir, key_), [ip_]))
429 win32_packages = [
"OpenRTM_aist",
430 "OpenRTM_aist.RTM_IDL",
431 "OpenRTM_aist.RTM_IDL.OpenRTM",
432 "OpenRTM_aist.RTM_IDL.OpenRTM__POA",
433 "OpenRTM_aist.RTM_IDL.RTC",
434 "OpenRTM_aist.RTM_IDL.RTC__POA",
435 "OpenRTM_aist.RTM_IDL.RTM",
436 "OpenRTM_aist.RTM_IDL.RTM__POA",
437 "OpenRTM_aist.RTM_IDL.SDOPackage",
438 "OpenRTM_aist.RTM_IDL.SDOPackage__POA",
439 "OpenRTM_aist.RTM_IDL.device_interfaces",
440 "OpenRTM_aist.examples.AutoControl",
441 "OpenRTM_aist.examples.Composite",
442 "OpenRTM_aist.examples.ConfigSample",
443 "OpenRTM_aist.examples.ExtTrigger",
444 "OpenRTM_aist.examples.MobileRobotCanvas",
445 "OpenRTM_aist.examples.NXTRTC",
446 "OpenRTM_aist.examples.SeqIO",
447 "OpenRTM_aist.examples.SimpleIO",
448 "OpenRTM_aist.examples.SimpleService",
449 "OpenRTM_aist.examples.Slider_and_Motor",
450 "OpenRTM_aist.examples.Templates",
451 "OpenRTM_aist.examples.TkJoyStick",
452 "OpenRTM_aist.examples.TkLRFViewer",
454 "OpenRTM_aist.ext.sdo",
455 "OpenRTM_aist.ext.sdo.observer",
456 "OpenRTM_aist.utils",
457 "OpenRTM_aist.utils.rtcd",
458 "OpenRTM_aist.utils.rtcprof",
459 "OpenRTM_aist.utils.rtc-template",
460 "OpenRTM_aist.utils.rtm-naming"]
462 unix_data_files = [(
"",[
'OpenRTM-aist.pth'])]
464 idl_files= glob.glob(os.path.join(
'OpenRTM_aist',
468 device_if_idl_files= glob.glob(os.path.join(
'OpenRTM_aist',
473 unix_data_files.append((os.path.join(
'OpenRTM_aist',
'utils',
'rtcd'),
474 [
'OpenRTM_aist/utils/rtcd/rtcd.conf']))
475 unix_data_files.append((os.path.join(
'OpenRTM_aist',
'utils',
'rtcd'),
476 [
'OpenRTM_aist/utils/rtcd/rtc.conf']))
477 unix_data_files.append((os.path.join(
'OpenRTM_aist',
'ext',
'sdo',
'observer'),
478 [
'OpenRTM_aist/ext/sdo/observer/rtc.conf']))
480 for idl
in idl_files:
481 unix_data_files.append((os.path.join(
'OpenRTM_aist',
'RTM_IDL'),
484 for device_idl
in device_if_idl_files:
485 unix_data_files.append((os.path.join(
'OpenRTM_aist',
'RTM_IDL',
486 'device_interfaces'), [device_idl]))
489 win32_data_files = copy.deepcopy(unix_data_files)
491 win32_data_files.append((os.path.join(
'OpenRTM_aist',
'examples'),
492 [
'OpenRTM_aist/examples/rtc.conf.sample']))
493 win32_data_files.append((os.path.join(
'OpenRTM_aist',
'examples'),
494 [
'OpenRTM_aist/examples/component.conf']))
495 win32_data_files.append((os.path.join(
'OpenRTM_aist',
'ext',
'sdo',
'observer'),
496 [
'OpenRTM_aist/ext/sdo/observer/setup.bat']))
498 unix_data_files.append((os.path.join(
'OpenRTM_aist',
'ext',
'sdo',
'observer'),
499 [
'OpenRTM_aist/ext/sdo/observer/setup.sh']))
501 templates_xml = glob.glob(os.path.join(
'OpenRTM_aist',
506 for tmp_xml
in templates_xml:
507 win32_data_files.append((os.path.join(
'OpenRTM_aist',
'examples',
'Templates'),
513 pkg_name =
"OpenRTM-aist-Python" 514 pkg_version =
"1.1.0" 515 pkg_desc =
"Python modules for OpenRTM-aist-1.1" 516 pkg_author =
"Shinji Kurihara and Noriaki Ando" 517 pkg_email =
"n-ando@aist.go.jp" 518 pkg_url =
"http://www.openrtm.org/" 520 OpenRTM-aist is a reference implementation of RT-Middleware, 521 which is now under standardization process in OMG (Object Management Group). 522 OpenRTM-aist is being developed and distributed by 523 Intelligent Systems Research Institute, 524 National Institute of Advanced Industrial Science and Technology (AIST), Japan. 525 Please see http://www.openrtm.org/ for more detail. 529 examples_install =
False 533 if cwd_.find(
"OpenRTM-aist-Python-example-1.1.0") != -1
or \
534 cwd_.find(
"openrtm-aist-python-example-1.1.0") != -1:
536 examples_install =
True 542 if not examples_install:
543 core.setup(name = pkg_name,
544 version = pkg_version,
545 description = pkg_desc,
547 author_email = pkg_email,
549 long_description = pkg_long_desc,
550 license = pkg_license,
551 cmdclass = {
"build":Build,
"build_idl":Build_idl,
"build_doc":Build_doc,
552 "sdist":OtherSetupForSdist,
"install":Install,
"install_data":InstallData },
553 packages = unix_packages,
554 scripts= [
'OpenRTM_aist/utils/rtcprof/rtcprof_python',
555 'OpenRTM_aist/utils/rtcd/rtcd_python'],
556 data_files = unix_data_files)
559 if sys.argv[1] ==
"sdist":
563 core.setup(name = pkg_name,
564 version = pkg_version,
565 description = pkg_desc,
567 author_email = pkg_email,
569 long_description = pkg_long_desc,
570 license = pkg_license,
571 cmdclass = {
"build":Build,
"build_idl":Build_idl,
"build_doc":Build_doc,
"sdist":OtherSetupForSdist},
572 packages = win32_packages,
573 scripts= [
'OpenRTM_aist/utils/rtcprof/rtcprof_python.bat',
574 'OpenRTM_aist/utils/rtcd/rtcd_python.bat',
575 'OpenRTM_aist/utils/rtcd/rtcd_python.exe',
576 'OpenRTM_aist/ext/sdo/observer/setup.bat'],
577 data_files = win32_data_files,
578 script_args = [
"sdist",
"--format=zip"])
583 pkg_name =
"OpenRTM-aist-Python-example" 584 pkg_desc =
"Python example components for OpenRTM-aist-1.1" 587 core.setup(name = pkg_name,
588 version = pkg_version,
589 description = pkg_desc,
591 author_email = pkg_email,
593 long_description = pkg_long_desc,
594 license = pkg_license,
595 cmdclass = {
"build":Build_examples,
"build_examples_idl":Build_examples_idl,
"sdist":OtherSetupForSdist },
596 data_files = example_data_files,
597 script_args = [
"sdist",
"--no-defaults"])
606 pkg_name =
"OpenRTM-aist-Python-example" 607 pkg_desc =
"Python example components for OpenRTM-aist-1.1" 609 core.setup(name = pkg_name,
610 version = pkg_version,
611 description = pkg_desc,
613 author_email = pkg_email,
615 long_description = pkg_long_desc,
616 license = pkg_license,
617 cmdclass = {
"build":Build_examples,
"build_examples_idl":Build_examples_idl,
"sdist":OtherSetupForSdist },
618 data_files = example_data_files)
620 elif g_os ==
"win32":
624 core.setup(name = pkg_name,
625 version = pkg_version,
626 description = pkg_desc,
628 author_email = pkg_email,
630 long_description = pkg_long_desc,
631 license = pkg_license,
632 cmdclass = {
"build":Build,
"build_idl":Build_idl,
"build_doc":Build_doc,
633 "install":Install,
"install_data":InstallData },
634 packages = win32_packages,
635 scripts= [
'OpenRTM_aist/utils/rtcprof/rtcprof_python.bat',
636 'OpenRTM_aist/utils/rtcd/rtcd_python.bat',
637 'OpenRTM_aist/utils/rtcd/rtcd_python.exe',
638 'OpenRTM_aist/ext/sdo/observer/setup.bat'],
639 data_files = win32_data_files)
643 log.error(
"Error: %s", e)
def has_c_libraries(self)
def make_distribution(self)
def has_pure_modules(self)
def finalize_options(self)
def finalize_options(self)
def has_c_libraries(self)
def initialize_options(self)
def has_ext_modules(self)
def initialize_options(self)
def initialize_options(self)
def initialize_options(self)
def has_ext_modules(self)
def has_pure_modules(self)
def finalize_options(self)
def gen_idl_name(dir, name)
def compile_idl(cmd, pars, files)