MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: finding package inExtraPackages`Enhancements`

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54183] Re: [mg54127] Re: [mg54096] Re: [mg54065] finding package inExtraPackages`Enhancements`
  • From: "David Annetts" <davidannetts at aapt.net.au>
  • Date: Sat, 12 Feb 2005 01:58:48 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Murray,

> I'm still at a loss here... What the installation directions 
> for Ersek's RootSearch.m actually say is to create, if it's 
> not already present, an Enhancements subdirectory of
>    ToFileName[{$TopDirectory, "AddOns", "ExtraPackages"}]

The notebook says that.  The Package (.m) says "This package can be
installed by first making an "Enhancements" folder under the
(...\AddOns\ExtraPackages) folder which should be among your hierarchy of
Mathematica folders."  The last five words are the key.

To me, this (ie "your hierarchy of Mathematica folders") means that you can
install the package in (amongst others) :-

1. In ToFileName[{$TopDirectory, "AddOns", "ExtraPackages",
"Enhancements"}].  Note that ToFileName[{$TopDirectory, "AddOns",
"ExtraPackages"}] is the directory that contains files for
ProgrammingInMathematica as well as the LinearAlgebraExamples (for 5.???).  

2. In ToFileName[{$UserBaseDirectory, "Applications", "ExtraPackages"}].
Why Applications" instead of "AddOns"?  ToFileName[{$UserBaseDirectory,
"Applications"}] is in my $Path whereas ToFileName[{$UserBaseDirectory,
"AddOns"}] in not.  Moreover, the last directory does not exist on my system
(not that this necessarily counts for anything).

Why look at the package instead of the notebook, especially when the package
is difficult to read using notepad?  The package gives the context, that's
why.  The context tells you the directory that the package needs to live in.
Where should this directory be?  This directory should be in the $Path.
Contexts are explained in Section 6.16.1 of the online help.  

> and to put RootSearch.m there.
> 
> But I want to separate all such add-ons from the Mathematica 
> $TopDirectory tree, so they can readily be preserved during 
> updates from one version of Mathematica to another.

That's a good thing to do but this would happen if you put things in
$UserBaseDirectory or $BaseDirectory.  Probably, it would also happen if you
put things in ToFileName[{$TopDirectory, "AddOns", "ExtraPackages"}], since
the uninstaller should only clear out files that the installer put in.  Note
that in general, $TopDirectory is not the same as $BaseDirectory.

> So I created a new tree under my $UserBaseDirectory, with top levels:
> 
>    FileNames[$UserBaseDirectory <> "\\*"] 
> {D:\Math\AddOns\AddOns, D:\Math\AddOns\Applications, 
> D:\Math\AddOns\Autoload, \ D:\Math\AddOns\Documentation, 
> D:\Math\AddOns\FrontEnd, D:\Math\AddOns\Kernel, \ 
> D:\Math\AddOns\Licensing, D:\Math\AddOns\SystemFiles, 
> D:\Math\AddOns\User}
> 
> But Mathematica does not seem to search within 
> D:\Math\AddOns\AddOns, so it never finds
> 
>    D:\Math\AddOns\AddOns\ExtraPackages\Enhancements
> 
> in which I placed RootSearch.m.
> 
> Previously, I had tried, instead, to put that ExtraPackages 
> tree at the top level of $UserBaseDirectory, so that:
> 
>    FileNames[$UserBaseDirectory <> "\\*"] 
> {D:\Math\AddOns\Applications, D:\Math\AddOns\Autoload, \ 
> D:\Math\AddOns\Documentation, D:\Math\AddOns\ExtraPackages, \ 
> D:\Math\AddOns\FrontEnd, D:\Math\AddOns\Kernel, 
> D:\Math\AddOns\Licensing, \ D:\Math\AddOns\SystemFiles, 
> D:\Math\AddOns\User}
> 
> Notice that the ExtraPackages directory was in that search 
> path, but still Mathematica does not find RootSearch in 
> response to command:

No.  It is in your directory heirarchy, but that does not mean that it is in
your search path.   Of your FileNames[$UserBaseDirectory <> "\\*"], only
{D:\Math\AddOns\Applications, D:\Math\AddOns\Autoload,
D:\Math\AddOns\Kernel} are in $Path.  See below.

> 
>    << Enhancements`RootSearch`
> 
> The trouble seems to be a lack of parallel in the way 
> Mathematica treats
> 
>    ToFileName[{$TopDirectory, "AddOns", "ExtraPackages"}]
> 
> and
> 
>    ToFileName[{$UserBaseDirectory, "AddOns", "ExtraPackages"}]
> 
> in that the former IS on the search path but the latter is not.

By default (for a Windows system), $Path is defined in
ToFileName[{$InstallationDirectory, "SystemFiles", "Kernel",
"SystemResources", "Windows"}, "sysinit.m"].  

$Path = 
    Join[
    	{
      	ToFileName[ {$InstallationDirectory, "AddOns"}, "JLink"],
      	ToFileName[ {$InstallationDirectory, "AddOns"}, "NETLink"],
        ToFileName[ $UserBaseDirectory, "Kernel"],
    	ToFileName[ $UserBaseDirectory, "Autoload"],
    	ToFileName[ $UserBaseDirectory, "Applications"],
    	ToFileName[ $BaseDirectory, "Kernel"],
    	ToFileName[ $BaseDirectory, "Autoload"],
    	ToFileName[ $BaseDirectory, "Applications"]
    	},
    	If[ $OperatingSystem === "MacOS", {":"}, {".", HomeDirectory[]}],
    	{
    	ToFileName[ {$InstallationDirectory, "AddOns"}, "StandardPackages"],
    	ToFileName[ {$InstallationDirectory, "AddOns", "StandardPackages"},
"StartUp"],
    	ToFileName[ {$InstallationDirectory, "AddOns"}, "Autoload"],
    	ToFileName[ {$InstallationDirectory, "AddOns"}, "Applications"],
    	ToFileName[ {$InstallationDirectory, "AddOns"}, "ExtraPackages"],
    	ToFileName[ {$InstallationDirectory, "SystemFiles","Graphics"},
"Packages"]
    	}];

As Treat has suggested in another post, you need to Append your $Path to
cope with what you've done.  At the risk of suggesting something that may
not work (quite likely, given what you've described above), the file
ToFileName[{$UserBaseDirectory, "Kernel"}, "init.m"] is the place to start.
You can modify the $Path by 
$Path = AppendTo[$Path, your_directory_goes_here].  For example, 
$Path = AppendTo[$Path, "c:/tmpfiles"] appends "c:\tmpfiles" to the $Path.
Why "/"?  Simply because it saves typing "\\".  

I don't see the different directories as a lack of parallel.  I see it as an
attempt by WRI to handle what it is installing (in $InstallationDirectory),
as well as what users might install system-wide (in $BaseDirectory) or for
specific users (in $UserBaseDirectory).  Perhaps Section A.8 of the online
help is some use?

Regards,

Dave.



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 10/02/2005


  • Prev by Date: Re: Re: Re: finding package in ExtraPackages`Enhancements`
  • Next by Date: Newbie question
  • Previous by thread: Re: upgraded to Fedora Core 3
  • Next by thread: Re: Re: Re: Re: finding package inExtraPackages`Enhancements`