Skip to content

Commit

Permalink
changing python to python3 and changing dict.iteritems() to python3 m…
Browse files Browse the repository at this point in the history
…ethod
  • Loading branch information
ConstantConstantin committed Apr 12, 2024
1 parent e39ab58 commit 13a4dba
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<name>org.python3.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
<nature>org.python3.pydev.pythonNature</nature>
</natures>
</projectDescription>
6 changes: 3 additions & 3 deletions .pydevproject
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<pydev_pathproperty name="org.python3.pydev.PROJECT_SOURCE_PATH">
<path>/rosjava_build_tools/src</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python3.pydev.PYTHON_PROJECT_VERSION">python3 2.7</pydev_property>
<pydev_property name="org.python3.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>
12 changes: 3 additions & 9 deletions env-hooks/15.rosjava.bash.em
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ SCRIPT=@(CMAKE_CURRENT_SOURCE_DIR)/generate_environment_variables.py
SCRIPT=@(CMAKE_INSTALL_PREFIX)/share/rosjava_build_tools/generate_environment_variables.py
@[end if]@

if command -v python 1>/dev/null; then PYTHON_EXECUTABLE=python
elif command -v python3 1>/dev/null; then PYTHON_EXECUTABLE=python3
elif command -v python2 1>/dev/null; then PYTHON_EXECUTABLE=python2
else PYTHON_EXECUTABLE=python
fi

export ROS_MAVEN_PATH="`${PYTHON_EXECUTABLE} ${SCRIPT} --maven-path`"
export ROS_MAVEN_DEPLOYMENT_REPOSITORY="`${PYTHON_EXECUTABLE} ${SCRIPT} --maven-deployment-repository`"
export ROS_MAVEN_REPOSITORY="`${PYTHON_EXECUTABLE} ${SCRIPT} --maven-repository`"
export ROS_MAVEN_PATH="`python3 ${SCRIPT} --maven-path`"
export ROS_MAVEN_DEPLOYMENT_REPOSITORY="`python3 ${SCRIPT} --maven-deployment-repository`"
export ROS_MAVEN_REPOSITORY="`python3 ${SCRIPT} --maven-repository`"
12 changes: 3 additions & 9 deletions env-hooks/15.rosjava.sh.em
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ SCRIPT=@(CMAKE_CURRENT_SOURCE_DIR)/generate_environment_variables.py
SCRIPT=@(CMAKE_INSTALL_PREFIX)/share/rosjava_build_tools/generate_environment_variables.py
@[end if]@

if command -v python 1>/dev/null; then PYTHON_EXECUTABLE=python
elif command -v python3 1>/dev/null; then PYTHON_EXECUTABLE=python3
elif command -v python2 1>/dev/null; then PYTHON_EXECUTABLE=python2
else PYTHON_EXECUTABLE=python
fi

export ROS_MAVEN_PATH="`${PYTHON_EXECUTABLE} ${SCRIPT} --maven-path`"
export ROS_MAVEN_DEPLOYMENT_REPOSITORY="`${PYTHON_EXECUTABLE} ${SCRIPT} --maven-deployment-repository`"
export ROS_MAVEN_REPOSITORY="`${PYTHON_EXECUTABLE} ${SCRIPT} --maven-repository`"
export ROS_MAVEN_PATH="`python3 ${SCRIPT} --maven-path`"
export ROS_MAVEN_DEPLOYMENT_REPOSITORY="`python3 ${SCRIPT} --maven-deployment-repository`"
export ROS_MAVEN_REPOSITORY="`python3 ${SCRIPT} --maven-repository`"
2 changes: 1 addition & 1 deletion generate_environment_variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os
import argparse
Expand Down
9 changes: 6 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
<buildtool_depend condition="$ROS_PYTHON_VERSION == 2">python-setuptools</buildtool_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 3">python3-setuptools</buildtool_depend>

<depend>ant</depend>
<depend>java</depend>
<exec_depend>catkin</exec_depend>
<build_depend>java</build_depend>
<build_depend>ant</build_depend>
<run_depend>java</run_depend>
<run_depend>ant</run_depend>
<run_depend>catkin</run_depend>
<run_depend>create-package</run_depend>
</package>
2 changes: 1 addition & 1 deletion scripts/catkin_create_android_library_project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""This script creates the skeleton of an android library package"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/catkin_create_android_pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""This script creates the skeleton of an android repo"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/catkin_create_android_project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""This script creates the skeleton of an android library package"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/catkin_create_rosjava_library_project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""This script creates the skeleton of a rosjava library project"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/catkin_create_rosjava_pkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""This script creates the skeleton of a rosjava catkin package (typically an entire repo)"""

Expand Down
2 changes: 1 addition & 1 deletion scripts/catkin_create_rosjava_project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""This script creates the skeleton of a rosjava application project"""

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from setuptools import setup
from catkin_pkg.python_setup import generate_distutils_setup
Expand Down
10 changes: 6 additions & 4 deletions src/rosjava_build_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
##############################################################################

from rosjava_build_tools import console

import rosjava_build_tools.console as console
from rosjava_build_tools.create_package import init_android_package, init_rosjava_package
from rosjava_build_tools.create_android_project import create_android_project
from rosjava_build_tools import create_android_project
#from create_android_project import create_android_project
from rosjava_build_tools.create_rosjava_project import create_rosjava_project, create_rosjava_msg_project, create_rosjava_library_project
from rosjava_build_tools.utils import which
from rosjava_build_tools.release import scrape_for_release_message_packages
from rosjava_build_tools import catkin
import rosjava_build_tools.catkin as catkin
4 changes: 2 additions & 2 deletions src/rosjava_build_tools/catkin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
Expand Down Expand Up @@ -40,7 +40,7 @@ def index_message_package_dependencies_from_local_environment(package_name_list=
be used for sequencing builds of packages.
@param package_name_list : sort dependencies for these packages only (defaults to all if empty)
@param package_paths : a python list of ros workspaces (defaults to ROS_PACKAGE_PATH if None is given)
@param package_paths : a python3 list of ros workspaces (defaults to ROS_PACKAGE_PATH if None is given)
@return dict mapping relative path to a catkin_pkg.Package
'''
if package_paths is None:
Expand Down
2 changes: 1 addition & 1 deletion src/rosjava_build_tools/console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
Expand Down
15 changes: 6 additions & 9 deletions src/rosjava_build_tools/create_android_project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
Expand All @@ -11,14 +11,10 @@
import argparse
import subprocess
import shutil
try:
import exceptions
except ImportError:
import builtins as exceptions

# local imports
from rosjava_build_tools import utils
from rosjava_build_tools import console
import rosjava_build_tools.utils as utils
import rosjava_build_tools.console as console

##############################################################################
# Methods
Expand Down Expand Up @@ -50,6 +46,7 @@ def parse_arguments():
return args



def actually_create_android_project(package_name, target_version, java_package_name, is_library):
path = os.path.join(os.getcwd(), package_name.lower())
console.pretty_println("\nCreating android project ", console.bold)
Expand All @@ -75,9 +72,9 @@ def actually_create_android_project(package_name, target_version, java_package_n
except subprocess.CalledProcessError:
print("Error")
raise subprocess.CalledProcessError("failed to create android project.")
except exceptions.OSError as e:
except OSError as e:
print("OS error" + str(e))
raise exceptions.OSError()
raise OSError()

# This is in the old form, let's shovel the shit around to the new form
utils.mkdir_p(os.path.join(path, 'src', 'main', 'java'))
Expand Down
7 changes: 6 additions & 1 deletion src/rosjava_build_tools/create_package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
Expand All @@ -12,8 +12,13 @@
from catkin_pkg.package_templates import create_package_xml, PackageTemplate

# local imports
<<<<<<< HEAD
from rosjava_build_tools import utils
from rosjava_build_tools import console
=======
import rosjava_build_tools.utils as utils
import rosjava_build_tools.console as console
>>>>>>> changing python to python3 and changing dict.iteritems() to python3 method

##############################################################################
# Methods
Expand Down
6 changes: 3 additions & 3 deletions src/rosjava_build_tools/create_rosjava_project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
Expand All @@ -13,8 +13,8 @@
import xml.etree.ElementTree as ElementTree

# local imports
from rosjava_build_tools import utils
from rosjava_build_tools import console
import rosjava_build_tools.utils as utils
import rosjava_build_tools.console as console

##############################################################################
# Methods
Expand Down
2 changes: 1 addition & 1 deletion src/rosjava_build_tools/release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
Expand Down
10 changes: 7 additions & 3 deletions src/rosjava_build_tools/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

##############################################################################
# Imports
Expand All @@ -8,7 +8,11 @@
import sys
import errno
import pwd
<<<<<<< HEAD
from rosjava_build_tools import console
=======
import rosjava_build_tools.console as console
>>>>>>> changing python to python3 and changing dict.iteritems() to python3 method

##############################################################################
# Methods
Expand All @@ -18,7 +22,7 @@
def distro_version():
'''
This code is pulled from rosversion, which unfortunately has it buried inside
the script, not in the python module.
the script, not in the python3 module.
'''
if 'ROS_DISTRO' in os.environ:
return os.environ['ROS_DISTRO']
Expand Down Expand Up @@ -81,7 +85,7 @@ def author_name():

def mkdir_p(path):
'''
Enables mkdir -p functionality (until python 3.2 is able to use
Enables mkdir -p functionality (until python3 3.2 is able to use
the mode argument to do the same).
'''
try:
Expand Down

0 comments on commit 13a4dba

Please sign in to comment.