Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: vpython/spec/spec.go

Issue 2927573002: [vpython] Fix PEP425 naming. (Closed)
Patch Set: rebase and update Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « vpython/spec/match_test.go ('k') | vpython/spec/spec_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The LUCI Authors. All rights reserved. 1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package spec 5 package spec
6 6
7 import ( 7 import (
8 "crypto/sha256" 8 "crypto/sha256"
9 "encoding/hex" 9 "encoding/hex"
10 "fmt" 10 "fmt"
(...skipping 26 matching lines...) Expand all
37 37
38 sort.Sort(pep425TagSlice(env.Pep425Tag)) 38 sort.Sort(pep425TagSlice(env.Pep425Tag))
39 return nil 39 return nil
40 } 40 }
41 41
42 // NormalizeSpec normalizes the specification Message such that two messages 42 // NormalizeSpec normalizes the specification Message such that two messages
43 // with identical meaning will have identical representation. 43 // with identical meaning will have identical representation.
44 // 44 //
45 // NormalizeSpec will prune any Wheel entries that don't match the specified 45 // NormalizeSpec will prune any Wheel entries that don't match the specified
46 // tags, and will remove the match entries from any remaining Wheel entries. 46 // tags, and will remove the match entries from any remaining Wheel entries.
47 func NormalizeSpec(spec *vpython.Spec, tags []*vpython.Pep425Tag) error { 47 func NormalizeSpec(spec *vpython.Spec, tags []*vpython.PEP425Tag) error {
48 if spec.Virtualenv != nil && len(spec.Virtualenv.MatchTag) > 0 { 48 if spec.Virtualenv != nil && len(spec.Virtualenv.MatchTag) > 0 {
49 // The VirtualEnv package may not specify a match tag. 49 // The VirtualEnv package may not specify a match tag.
50 spec.Virtualenv.MatchTag = nil 50 spec.Virtualenv.MatchTag = nil
51 } 51 }
52 52
53 // Apply match filters, prune any entries that don't match, and clear th e 53 // Apply match filters, prune any entries that don't match, and clear th e
54 // MatchTag entries for those that do. 54 // MatchTag entries for those that do.
55 pos := 0 55 pos := 0
56 for _, wheel := range spec.Wheel { 56 for _, wheel := range spec.Wheel {
57 if !PackageMatches(wheel, tags) { 57 if !PackageMatches(wheel, tags) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 func (s specPackageSlice) Len() int { return len(s) } 117 func (s specPackageSlice) Len() int { return len(s) }
118 func (s specPackageSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } 118 func (s specPackageSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
119 119
120 func (s specPackageSlice) Less(i, j int) bool { 120 func (s specPackageSlice) Less(i, j int) bool {
121 return sortby.Chain{ 121 return sortby.Chain{
122 func(i, j int) bool { return s[i].Name < s[j].Name }, 122 func(i, j int) bool { return s[i].Name < s[j].Name },
123 func(i, j int) bool { return s[i].Version < s[j].Version }, 123 func(i, j int) bool { return s[i].Version < s[j].Version },
124 }.Use(i, j) 124 }.Use(i, j)
125 } 125 }
126 126
127 type pep425TagSlice []*vpython.Pep425Tag 127 type pep425TagSlice []*vpython.PEP425Tag
128 128
129 func (s pep425TagSlice) Len() int { return len(s) } 129 func (s pep425TagSlice) Len() int { return len(s) }
130 func (s pep425TagSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } 130 func (s pep425TagSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
131 131
132 func (s pep425TagSlice) Less(i, j int) bool { 132 func (s pep425TagSlice) Less(i, j int) bool {
133 return sortby.Chain{ 133 return sortby.Chain{
134 » » func(i, j int) bool { return s[i].Version < s[j].Version }, 134 » » func(i, j int) bool { return s[i].Python < s[j].Python },
135 func(i, j int) bool { return s[i].Abi < s[j].Abi }, 135 func(i, j int) bool { return s[i].Abi < s[j].Abi },
136 » » func(i, j int) bool { return s[i].Arch < s[j].Arch }, 136 » » func(i, j int) bool { return s[i].Platform < s[j].Platform },
137 }.Use(i, j) 137 }.Use(i, j)
138 } 138 }
OLDNEW
« no previous file with comments | « vpython/spec/match_test.go ('k') | vpython/spec/spec_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698