lshifr / ProjectInstaller

Other
9 stars 3 forks source link

Standard Mathematica application structure not recognized #2

Open halirutan opened 10 years ago

halirutan commented 10 years ago

The following repository contains a package structure which is more or less the standard template structure created by Wolfram WB

SpectralisOCT/
├── project.m
├── README.md
├── SpectralisOCT
│   ├── Kernel
│   │   └── init.m
│   └── SpectralisOCT.m
└── SpectralisOCT.iml

I have put "name" -> "SpectralisOCT" in the project.m but I get this error when I try to install master.zip from GitHub

ProjectInstall::noprjpckg: The project has no package in the top-level directory with the name mathcing the name of the project specified in project's descriptor file (project.m)

Compared to the MATLink package which seems to work, I have the Mathematica package itself in a subdirectory because I don't want to distribute e.g. Java source files, resources or project files.

Btw, this implies that the ProjectInstaller itself cannot be installed with the ProjectInstaller.

lshifr commented 10 years ago

In fact, the structure created by WB is optimized for development but not deployment. I have described this here: http://mathematica.stackexchange.com/questions/14339/how-to-work-with-application-project-files-in-wolfram-workbench/14351#14351. Usually, for deployment, one writes a build script where the structure gets, in some sense, flattened, so that there is a single level of nesting for the folder with the project name. In particular, if you copy the WB-generated project and try using it stand-alone from some directory like $UserBaseDirectory, it will likely fail due to the wrong level of nesting (2 instead of 1).

In any case, the correct logic seems to be the following: either check for the main package with the same name as a project, or for the existence of init.m in the /Kernel folder. I will double-check that this is what ProjectInstaller does, there may be a bug there.

lshifr commented 10 years ago

I have removed that check, so things should (hopefully) work now. Alas, no time to thoroughly test right now. In any case, there should be only a single level of folder nesting in the project (as I mentioned in the prev.comment), or Mathematica won't find it - because otherwise the /Kernel folder and / or the main package will be too deep to be found.