Changeset 806
- Timestamp:
- 05/09/08 11:30:28 (8 months ago)
- Files:
-
- pyrun/trunk/pyrun.py (modified) (7 diffs)
- pyrun/trunk/pyrunscripts.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pyrun/trunk/pyrun.py
r804 r806 6 6 7 7 from os.path import join, dirname, basename, isfile, isdir, exists 8 from os.path import splitext 8 from os.path import splitext, abspath, normpath, expandvars, expanduser 9 9 10 10 import logging … … 212 212 213 213 def evaluate_packagepath(path, name='', allow_egglinks=False): 214 if isegg_path(path, allow_links=allow_egglinks): 215 return name or path 214 215 if isegg_path(path, allow_links=True): 216 if not isegg_path(path, allow_links=False): 217 if not allow_egglinks: 218 return False 219 egg_pth = file(path, 'r').read().strip() 220 egg_pth = egg_pth.split('\n')[0].strip() 221 return name or normpath(abspath(join(dirname(path), egg_pth))) 222 else: 223 return name or path 224 216 225 if (isdir(path) and '.' not in name and ( 217 226 isfile(join(path, '__init__.py')) or … … 324 333 short_opts = {} 325 334 326 assert ia <= len(argv) , (335 assert ia <= len(argv) + 1, ( 327 336 'ia=%s, argv="%s"' 328 337 ) % (ia, str(argv) 329 338 ) 330 if ia == len(argv):339 if ia >= len(argv): 331 340 return [] 332 341 … … 343 352 # 344 353 345 if argv[ia] == '--' :354 if argv[ia] == '--' or argv[ia] == '-': 346 355 del argv[ia] 347 356 else: 348 349 357 # Short or long ? 350 358 if argv[ia].startswith('--'): … … 460 468 pthextend.extend(newpaths) 461 469 findpaths[:] = [] 462 pthextend.extend(ln.strip() for ln in file(a) 463 if exists(ln.strip()) 464 ) 470 pthdir = normpath(abspath(dirname(a))) 471 for ln in file(a): 472 ln = ln.strip() 473 pth = join(abspath(expandvars(expanduser(ln)))) 474 if exists(pth): 475 pthextend.append(pth) 476 else: 477 doesnotexist.append(ln) 478 465 479 continue 466 480 … … 823 837 ) 824 838 if opts.P: 825 banner += '\n\nPYT ONPATH=%s' % os.pathsep.join(839 banner += '\n\nPYTHONPATH=%s' % os.pathsep.join( 826 840 pthextend 827 841 ) … … 892 906 893 907 USAGE_runex="""\ 894 %prog [-nidDpP] [BASEPATH(s)][-m mod.name | '--'] [TARGET-OPTIONS] 895 896 In most cases the solo '--' is not required. It tends to be useful when you 897 implicitly select the module to run AND you want to pass a non option argument 898 as the first value in the command line for that module. It can also be 908 %prog [-nidDpP] [BASEPATH(s)][-m mod.name | '--' | '-' ] [TARGET-OPTIONS] 909 910 Discover python packages and modules under BASEPATH(s). Run the first module 911 file named in `BASEPATH(s)` *OR* explicitly nominated using the `-m` option. 912 BASEPATH can reference python .pth files, in which case the paths in that file 913 are inserted. 914 915 Note that the 'import ' lines are not supported in .pth files, that the paths 916 are interpreted as relative to the directory containing the .pth file and that 917 environment variables and '~' are fully expanded. 918 919 In most cases the solo '--' or '-' is not required. It tends to be useful when 920 you implicitly select the module to run AND you want to pass a non option 921 argument as the first value in the command line for that module. It can also be 899 922 necessary when the target module has short options, without long-name 900 923 alternatives, which collide with those defined for pyrun. 901 902 Discover python packages and modules under PATH. Run the first module file903 named in `PATH` *OR* explicitly nominated using the `-m` option.904 924 905 925 NOTE: Any option that is marked [NYI] is Not Yet Implemented.""" pyrun/trunk/pyrunscripts.py
r804 r806 170 170 # No explicit script selection, take them all 171 171 reqs = [env[project][0].as_requirement() for project in env] 172 print reqs 172 173 173 174