Skip to content

Commit

Permalink
Add replace option to fix-requires-by-path tool as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-turney committed Mar 26, 2024
1 parent d561703 commit 10a4242
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion calm/fix-requires-by-path.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def fix_one_hint(args, dirpath, hintfile, tf):
if ivp:
requires = hints.get('requires', '').split()
if args.requires not in requires:
if args.replace and args.replace in requires:
requires.remove(args.replace)
requires.append(args.requires)
requires = sorted(requires)
modified = True
Expand All @@ -82,7 +84,8 @@ def fix_one_hint(args, dirpath, hintfile, tf):
# write updated hints
shutil.copy2(pn, pn + '.bak')
hint.hint_file_write(pn, hints)
# os.system('/usr/bin/diff -uBZ %s %s' % (pn + '.bak', pn))
if args.verbose:
os.system('/usr/bin/diff -uBZ %s %s' % (pn + '.bak', pn))


def fix_hints(args):
Expand All @@ -109,6 +112,7 @@ def fix_hints(args):
parser.add_argument('requires', metavar='DEPATOM', help='require to add')
parser.add_argument('-v', '--verbose', action='count', dest='verbose', help='verbose output', default=0)
parser.add_argument('--releasearea', action='store', metavar='DIR', help="release directory (default: " + relarea_default + ")", default=relarea_default, dest='relarea')
parser.add_argument('--replace', action='store', metavar='DEPATOM', help="replace existing DEPATOM if present")
(args) = parser.parse_args()

if not args.path.startswith('/'):
Expand Down

0 comments on commit 10a4242

Please sign in to comment.