* fix #13150 `nim doc --project` works with duplicate names and with imports below main project file * add to help; fixup after #13212 isRelativeTo got merged * fix test tests/compilerapi/tcompilerapi.nim * remove nimblePkg field; compute on the fly instead * kochdocs: compiler docs now under compiler/ * --docRoot now has smart default: best among @pkg, @path
This commit is contained in:
parent
574f61315d
commit
7ec7731f82
12 changed files with 132 additions and 27 deletions
|
|
@ -15,10 +15,8 @@ iterator myParentDirs(p: string): string =
|
|||
if current.len == 0: break
|
||||
yield current
|
||||
|
||||
proc resetPackageCache*(conf: ConfigRef) =
|
||||
conf.packageCache = newPackageCache()
|
||||
|
||||
proc getPackageName*(conf: ConfigRef; path: string): string =
|
||||
proc getNimbleFile*(conf: ConfigRef; path: string): string =
|
||||
## returns absolute path to nimble file, eg: /pathto/cligen.nimble
|
||||
var parents = 0
|
||||
block packageSearch:
|
||||
for d in myParentDirs(path):
|
||||
|
|
@ -27,7 +25,7 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
|
|||
return conf.packageCache[d]
|
||||
inc parents
|
||||
for file in walkFiles(d / "*.nimble"):
|
||||
result = file.splitFile.name
|
||||
result = file
|
||||
break packageSearch
|
||||
# we also store if we didn't find anything:
|
||||
when not defined(nimNoNilSeqs):
|
||||
|
|
@ -38,6 +36,11 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
|
|||
dec parents
|
||||
if parents <= 0: break
|
||||
|
||||
proc getPackageName*(conf: ConfigRef; path: string): string =
|
||||
## returns nimble package name, eg: `cligen`
|
||||
let path = getNimbleFile(conf, path)
|
||||
result = path.splitFile.name
|
||||
|
||||
proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
|
||||
# Convert `path` so that 2 modules with same name
|
||||
# in different directory get different name and they can be
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue