~ubuntu-branches/ubuntu/trusty/dblatex/trusty

« back to all changes in this revision

Viewing changes to lib/contrib/which/TODO.txt

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Hoenen
  • Date: 2006-11-18 09:52:18 UTC
  • mfrom: (3.1.2 feisty)
  • Revision ID: james.westby@ubuntu.com-20061118095218-zsibrzxr9w6e2lor
Tags: 0.2-2
Do not depend on script mktexlsr belonging to a non-essential package
in postrm purge. (Urgency set to high due to serious severity.)
Closes: #398776

Show diffs side-by-side

added added

removed removed

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