For info, makepanda.py, prc_dir variable is at PANDA_PRC_DIR

Just for info, makepanda.py uses PANDA_PRC_DIR instead of PRC_DIR.

Hugh

Yes, that’s true, but I’m keeping that quietly to myself. For a variety of reasons, I don’t like the use of environment variables. So I added some code to panda so that it can find its Config file without any environment variables at all.

Here’s how it works. It starts by locating “libdtool.dll” or “libdtool.so” using operating system queries to do so. Starting at that directory, it walks up the directory tree, until it finds a subdirectory “etc” containing a PRC file. So let’s say that the library is in c:\my-game\panda\lib\libdtool.dll. In that case, the search for Config.prc looks here:

c:\my-game\panda\lib\etc\Config.prc
c:\my-game\panda\etc\Config.prc
c:\my-game\etc\Config.prc
c:\etc\Config.prc

I’ve found that this strategy works very well. It makes it easy to put the config file in a system-wide “etc” directory (as is traditional under Linux), or to put the config file into the panda directory itself (as is traditional under Windows). It also makes it easy to override a global config file with a version-specific one.

So, all around, I’d rather you not use the environment variables unless you’re sure you need them. I’m hoping we can phase them out some day.

I’m running into a problem while I’m using GNU make to build a Panda-based project. The Panda distribution from this site is expected to be installed on the machine, but we don’t enforce specific paths for where it might be. We use that mainly for build tools. I’m trying to run ‘egg2bam’ from inside a GNU make file and getting errors because there is a new ObjectType in our custom .PRC file that our eggs expect to be available.

I could correct the error by putting the custom .PRC into the installed Panda ‘etc’ directory, but I’d prefer not to. I’d like to use the .PRC as it sits inside our build tree (basically all the game source and assets extracted from version control). That way if new entries are added, every machine that does ‘builds’ wouldn’t have to copy the updated .PRC into their common ‘etc’ directory.

I thought that PRC_DIR would be a good option, but it doesn’t seem to affect how egg2bam finds its .PRC files. Any suggestions?

PRC_DIR should certainly affect egg2bam along with any other Panda utility, in the same way that it affects Python code running Panda. If it’s not working, it may be that this particular build of Panda was customized to use a different environment variable than PRC_DIR. Have you tried using PANDA_PRC_DIR, as this thread suggests?

David

I did end up getting that to work right after I posted. I figured I’d keep it up for two reasons:

  1. It seemed that the intent to phase out the environment variables might preclude this type of approach.
  2. I hadn’t yet seen PANDA_PRC_DIR documented anywhere. It would be nice if the ones that are documented worked as advertised.

thanks for the feedback.

Fran