Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Windows #811

Merged
merged 2 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rosdep2/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def __init__(self, detect_fn, supports_depends=False):
self.detect_fn = detect_fn
self.supports_depends = supports_depends
self.as_root = True
self.sudo_command = 'sudo -H' if os.geteuid() != 0 else ''
self.sudo_command = 'sudo -H' if hasattr(os, 'geteuid') and os.geteuid() != 0 else ''

def elevate_priv(self, cmd):
"""
Expand Down
9 changes: 6 additions & 3 deletions src/rosdep2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def rosdep_main(args=None):
except UsageError as e:
print(_usage, file=sys.stderr)
print('ERROR: %s' % (str(e)), file=sys.stderr)
sys.exit(os.EX_USAGE)
if hasattr(os, 'EX_USAGE'):
sys.exit(os.EX_USAGE)
else:
sys.exit(64) # EX_USAGE is not available on Windows; EX_USAGE is 64 on Unix
except RosdepInternalError as e:
print("""
ERROR: Rosdep experienced an internal error.
Expand Down Expand Up @@ -499,9 +502,9 @@ def _package_args_handler(command, parser, options, args):
if command in ['install', 'check', 'keys'] and options.ignore_src:
if options.verbose:
print('Searching ROS_PACKAGE_PATH for '
'sources: ' + str(os.environ['ROS_PACKAGE_PATH'].split(':')))
'sources: ' + str(os.environ['ROS_PACKAGE_PATH'].split(os.pathsep)))
ws_pkgs = get_workspace_packages()
for path in os.environ['ROS_PACKAGE_PATH'].split(':'):
for path in os.environ['ROS_PACKAGE_PATH'].split(os.pathsep):
path = os.path.abspath(path.strip())
if os.path.exists(path):
pkgs = find_catkin_packages_in(path, options.verbose)
Expand Down
1 change: 1 addition & 0 deletions src/rosdep2/platforms/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def install_source(resolved):
rd_debug('Extracting tarball')
tarf = tarfile.open(filename)
tarf.extractall(tempdir)
tarf.close()
else:
rd_debug('Bypassing tarball extraction as it is a dmg')
rd_debug('Running installation script')
Expand Down
3 changes: 2 additions & 1 deletion src/rosdep2/shell_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def create_tempfile_from_string_and_execute(string_script, path=None, exec_fn=No

result = 1
try:
fh = tempfile.NamedTemporaryFile('w', delete=False)
script_ext = '.bat' if os.name == 'nt' else ''
fh = tempfile.NamedTemporaryFile('w', suffix=script_ext, delete=False)
fh.write(string_script)
fh.close()
rd_debug('Executing script below with cwd=%s\n{{{\n%s\n}}}\n' % (path, string_script))
Expand Down