TODO.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # High Priority
  2. - Figure out the script story on the various platforms. On Windows, look into
  3. the launcher thing that effbot has. Unix, don't install the script my
  4. default. They can always do "python -m which ..." with Python >= 2.4.
  5. Suggest an alias that some folks might want to use for that.
  6. # Medium Priority
  7. - define __all__?
  8. - improve test suite
  9. - test with other versions of Python
  10. - get the PATHEXT attached extension to reflect the actual canonical
  11. case of file matches on Windows, currently the extension from PATHEXT
  12. is always uppercase
  13. - What to do with Change 145624 by shanec. It is a bit of a
  14. bastardization. Maybe allow this with a special option to allow the change
  15. in semantics.
  16. > Change 145624 by shanec@shanec-ocelotl on 2005/05/24 16:51:55
  17. >
  18. > make which work better on OSX
  19. > - add support for searching /Applications and /Network/Applications
  20. > - add support for .app bundles
  21. >
  22. > Affected files ...
  23. >
  24. > ... //depot/main/Apps/Komodo-devel/src/python-sitelib/which.py#7 edit
  25. >
  26. > Differences ...
  27. >
  28. > ==== //depot/main/Apps/Komodo-devel/src/python-sitelib/which.py#7 (text) ====
  29. >
  30. > @@ -126,10 +126,11 @@
  31. > sys.stderr.write("duplicate: %s (%s)\n" % potential)
  32. > return None
  33. > else:
  34. > - if not stat.S_ISREG(os.stat(potential[0]).st_mode):
  35. > + darwinApp = sys.platform == 'darwin' and potential[0][-4:]=='.app'
  36. > + if not darwinApp and not stat.S_ISREG(os.stat(potential[0]).st_mode):
  37. > if verbose:
  38. > sys.stderr.write("not a regular file: %s (%s)\n" % potential)
  39. > - elif not os.access(potential[0], os.X_OK):
  40. > + elif not darwinApp and not os.access(potential[0], os.X_OK):
  41. > if verbose:
  42. > sys.stderr.write("no executable access: %s (%s)\n"\
  43. > % potential)
  44. > @@ -166,6 +167,9 @@
  45. > path = os.environ.get("PATH", "").split(os.pathsep)
  46. > if sys.platform.startswith("win"):
  47. > path.insert(0, os.curdir) # implied by Windows shell
  48. > + if sys.platform == 'darwin':
  49. > + path.insert(0, '/Network/Applications')
  50. > + path.insert(0, '/Applications')
  51. > else:
  52. > usingGivenPath = 1
  53. >
  54. > @@ -182,6 +186,9 @@
  55. > exts = ['.COM', '.EXE', '.BAT']
  56. > elif not isinstance(exts, list):
  57. > raise TypeError("'exts' argument must be a list or None")
  58. > + elif sys.platform == 'darwin':
  59. > + if exts is None:
  60. > + exts = ['.app']
  61. > else:
  62. > if exts is not None:
  63. > raise WhichError("'exts' argument is not supported on "\
  64. > @@ -202,7 +209,8 @@
  65. > for ext in ['']+exts:
  66. > absName = os.path.abspath(
  67. > os.path.normpath(os.path.join(dirName, command+ext)))
  68. > - if os.path.isfile(absName):
  69. > + if os.path.isfile(absName) or (sys.platform == 'darwin' and \
  70. > + absName[-4:]=='.app' and os.path.isdir(absName)):
  71. > if usingGivenPath:
  72. > fromWhere = "from given path element %d" % i
  73. > elif not sys.platform.startswith("win"):
  74. Here is a start with slight improvements:
  75. > Index: which.py
  76. > ===================================================================
  77. > --- which.py (revision 270)
  78. > +++ which.py (working copy)
  79. > @@ -126,9 +126,18 @@
  80. > sys.stderr.write("duplicate: %s (%s)\n" % potential)
  81. > return None
  82. > else:
  83. > - if not stat.S_ISREG(os.stat(potential[0]).st_mode):
  84. > + st_mode = os.stat(potential[0]).st_mode
  85. > + isMacAppBundle = sys.platform == "darwin" \
  86. > + and potential[0].endswith(".app") \
  87. > + and stat.S_ISDIR(st_mode)
  88. > + if not isMacAppBundle and not stat.S_ISREG(st_mode):
  89. > if verbose:
  90. > - sys.stderr.write("not a regular file: %s (%s)\n" % potential)
  91. > + if sys.platform == "darwin":
  92. > + sys.stderr.write("not a regular file or .app bundle: "
  93. > + "%s (%s)\n" % potential)
  94. > + else:
  95. > + sys.stderr.write("not a regular file: %s (%s)\n"
  96. > + % potential)
  97. > elif not os.access(potential[0], os.X_OK):
  98. > if verbose:
  99. > sys.stderr.write("no executable access: %s (%s)\n"\
  100. # Low Priority
  101. - have a version for pre-generators (i.e. Python 2.1)
  102. - add a "logging" interface