Changeset 65347


Ignore:
Timestamp:
Jun 1, 2015, 7:42:58 AM (9 years ago)
Author:
wenzeslaus
Message:

init: escape backslash in prompt string

This avoids anomalous-backslash-in-string warning (W1401) in Pylint. It is just a warning because the unknown escape sequence is ignored and thus the backslash is preserved for bash. The other solution would be to use raw strings but this complicates usage of newline character. BTW, backslash lowercase w means 'current absolute path' for bash.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass/trunk/lib/init/grass.py

    r65307 r65347  
    14281428    f.write("test -r ~/.alias && . ~/.alias\n")
    14291429    if os.getenv('ISISROOT'):
    1430         f.write("PS1='ISIS-GRASS %s (%s):\w > '\n" % (grass_version, location_name))
    1431     else:
    1432         f.write("PS1='GRASS %s (%s):\w > '\n" % (grass_version, location_name))
     1430        f.write("PS1='ISIS-GRASS %s (%s):\\w > '\n" % (grass_version, location_name))
     1431    else:
     1432        f.write("PS1='GRASS %s (%s):\\w > '\n" % (grass_version, location_name))
    14331433
    14341434    f.write("""grass_prompt() {
     
    14711471        cleanup_dir(os.path.join(location, ".tmp"))  # remove GUI session files from .tmp
    14721472    else:
    1473         os.environ['PS1'] = "GRASS %s (%s):\w > " % (grass_version, location_name)
     1473        os.environ['PS1'] = "GRASS %s (%s):\\w > " % (grass_version, location_name)
    14741474        exit_val = call([gpath("etc", "run"), os.getenv('SHELL')])
    14751475
Note: See TracChangeset for help on using the changeset viewer.