Skip to content

Commit c4ba452

Browse files
authored
tools/python.jam regexp review, et al... (#498)
1 parent f78db52 commit c4ba452

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/tools/python.jam

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ local rule is-cygwin-symlink ( path )
174174
local base-pat = [ regex.escape $(path:D=) : "].[()*+?|\\$^" : \\ ] ;
175175

176176
# Extract the file's size from the directory listing.
177-
local size-of-system-file = [ MATCH "([0-9]+) "$(base-pat) : $(dir-listing) : 1 ] ;
177+
local size-of-system-file = [ MATCH "([0-9]+) "$(base-pat) : $(dir-listing) ] ;
178178

179179
# If the file has a reasonably small size, look for the special symlink
180180
# identification text.
@@ -184,9 +184,8 @@ local rule is-cygwin-symlink ( path )
184184
if $(link[2]) != 0
185185
{
186186
local nl = "
187-
188187
" ;
189-
is-symlink = [ MATCH ".*!<symlink>([^"$(nl)"]*)" : $(link[1]) : 1 ] ;
188+
is-symlink = [ MATCH "!<symlink>([^"$(nl)"]*)" : $(link[1]) ] ;
190189
if $(is-symlink)
191190
{
192191
is-symlink = [ *nix-path-to-native $(is-symlink) ] ;
@@ -287,7 +286,7 @@ local rule windows-to-cygwin-path ( path )
287286
local p = [ SUBST $(path:T) $(.windows-drive-letter-re) /cygdrive/$1/$2 ] ;
288287

289288
# Else if path is rooted without a drive letter, use the working directory.
290-
p ?= [ SUBST $(path:T) ^/(.*) /cygdrive/$(.working-drive-letter:L)/$2 ] ;
289+
p ?= [ SUBST $(path:T) ^/(.*) /cygdrive/$(.working-drive-letter:L)/$1 ] ;
291290

292291
# Else return the path unchanged.
293292
return $(p:E=$(path:T)) ;
@@ -396,7 +395,7 @@ local rule path-to-native ( paths * )
396395
#
397396
local rule split-version ( version )
398397
{
399-
local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)(.*)$" : $(version) : 1 2 3 ] ;
398+
local major-minor = [ MATCH "^([0-9]+)\\.([0-9]+)(.*)$" : $(version) ] ;
400399
if ! $(major-minor[2]) || $(major-minor[3])
401400
{
402401
ECHO "Warning: \"using python\" expects a two part (major, minor) version number; got" $(version) instead ;
@@ -416,7 +415,7 @@ local rule split-version ( version )
416415
.version-countdown = ;
417416
for local v in [ numbers.range 15 34 ]
418417
{
419-
.version-countdown = [ SUBST $(v) (.)(.*) $1.$2 ] $(.version-countdown) ;
418+
.version-countdown = [ SUBST $(v) (.)(.+) $1.$2 ] $(.version-countdown) ;
420419
}
421420

422421

@@ -505,7 +504,6 @@ local rule probe ( python-cmd )
505504
{
506505
# Parse the output to get all the results.
507506
local nl = "
508-
509507
" ;
510508
for s in $(sys-elements)
511509
{

0 commit comments

Comments
 (0)