Skip to content

Commit

Permalink
[Issue JdeRobot#485] Refactor easyiceconfig PY to use CMAKE_INSTALL_P…
Browse files Browse the repository at this point in the history
…REFIX
  • Loading branch information
lr-morales committed Jul 30, 2016
1 parent e91d454 commit ca9d26d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
26 changes: 23 additions & 3 deletions src/libs/easyiceconfig_py/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
cmake_minimum_required(VERSION 2.8)

configure_file(
easyiceconfig/hardcodedpaths.py.in
easyiceconfig/hardcodedpaths.py
@ONLY
)

file(GLOB ModuleFiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/easyiceconfig
${CMAKE_CURRENT_SOURCE_DIR}/easyiceconfig/*)

string(REGEX REPLACE "[^;]+\\.in;?" "" ModuleFiles "${ModuleFiles}")


add_custom_target(easyiceconfig_py)
foreach(ModuleFile ${ModuleFiles})
add_custom_command(TARGET easyiceconfig_py
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/easyiceconfig/${ModuleFile} ${CMAKE_CURRENT_BINARY_DIR}/easyiceconfig/${ModuleFile}
)
endforeach(ModuleFile ${ModuleFiles})

### Install
install(DIRECTORY easyiceconfig
DESTINATION /usr/lib/python2.7/
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/easyiceconfig
DESTINATION ${PYTHON_MODULE_PATH}
COMPONENT core
)

8 changes: 4 additions & 4 deletions src/libs/easyiceconfig_py/easyiceconfig/easyiceconfig.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 1997-2015 JDE Developers Team
# Copyright (C) 1997-2016 JDE Developers Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -22,7 +22,7 @@
import re
import Ice

from hardcoredpaths import HARDCORED_PATHS
from hardcodedpaths import HARDCODED_PATHS


ENV_PATH_NAME = "ICE_CONFIG_PATH"
Expand All @@ -33,8 +33,8 @@ def findConfigFile(filename):
env_paths = os.getenv(ENV_PATH_NAME)
if env_paths:
paths = paths+":"+env_paths
if HARDCORED_PATHS:
paths = paths+":"+HARDCORED_PATHS
if HARDCODED_PATHS:
paths = paths+":"+HARDCODED_PATHS

for path in paths.split(":"):
file_path = os.path.join(path, filename)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 1997-2015 JDE Developers Team
# Copyright (C) 1997-2016 JDE Developers Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,12 +20,12 @@


# JdeRobot main Ice.Config path
JDEROBOT_PATHS = "/usr/local/share/jderobot/conf"
JDEROBOT_PATHS = "@CMAKE_INSTALL_PREFIX@/share/jderobot/conf"


# JdeRobot Gazebo's plugins Ice.Config path
import os
JDEROBOT_GAZEBO_PLUGINS_BASE_PATH = '/usr/local/share/jderobot/gazebo/plugins'
JDEROBOT_GAZEBO_PLUGINS_BASE_PATH = '@CMAKE_INSTALL_PREFIX@/share/jderobot/gazebo/plugins'

gazebo_plugins = list()
for dir in os.listdir(JDEROBOT_GAZEBO_PLUGINS_BASE_PATH):
Expand All @@ -35,5 +35,5 @@
JDEROBOT_GAZEBO_PLUGINS_PATHS = ':'.join(str(x) for x in gazebo_plugins)


# "Hardcored" PATHS
HARDCORED_PATHS = "%s:%s" %(JDEROBOT_PATHS, JDEROBOT_GAZEBO_PLUGINS_PATHS)
# "Hardcoded" PATHS
HARDCODED_PATHS = "%s:%s" %(JDEROBOT_PATHS, JDEROBOT_GAZEBO_PLUGINS_PATHS)

0 comments on commit ca9d26d

Please sign in to comment.