0

on windows 7, tcl 8.6.4.

My repo.tcl and region.tcl files are both in c:\sites\vive

repo is a package:

package provide repo 1.0

namespace eval ::repo {}
namespace eval ::repo::create{}

proc ::repo::create {} {...} ...

region.tcl wants access to the procs in repo.tcl so it looks like this:

#source ./repo.tcl <---------old method, want to replace with package require
lappend auto_path [pwd] ;#<--puts c:\sites\vive in the autopath so package can find it.

package require repo 1.0 ;#<--tried this with out version number as well. same result.

::repo::create

...

I always get this error:

can't find package repo 1.0

Both of these sites have suggested I use the lappend auto_path https://unix.stackexchange.com/questions/44992/package-require-xxxx-tcl Can't find package BLT

What am I doing wrong? thanks!

Community
  • 1
  • 1
MetaStack
  • 3,266
  • 4
  • 30
  • 67

1 Answers1

2

You have to generate the pkgIndex.tcl file using pkg_mkIndex

% pkg_mkIndex -verbose [pwd] repo.tcl
successful sourcing of repo.tcl
packages provided were {repo 1.0}
processed repo.tcl
% lappend auto_path [pwd]
C:/Dinesh/Backup/cmder/vendor/msysgit/lib/tcl8.5 C:/Dinesh/Backup/cmder/vendor/msysgit/lib C:/Users/dsivaji/Desktop/delete
%
%
%
% package require repo
1.0

Have a look at the man page pkg_mkIndex for more information.

Dinesh
  • 16,014
  • 23
  • 80
  • 122
  • Strictly, you don't need to use `pkg_mkIndex`. It's just convenient. – Donal Fellows Nov 08 '15 at 23:29
  • @DonalFellows : `pkgIndex.tcl` is needed anyway. An index file which has the package information should be placed in the `auto_path` location. We are using `pkg_mkIndex` procedure to ease our job. Correct me Sir, if I'm wrong. – Dinesh Nov 09 '15 at 01:17