Skip to content
Graham R Pugh edited this page Jun 15, 2019 · 2 revisions

Notes for Developers and the Intrigued

Developer Setup

If you want to hack on the code, you will need to fork & clone the project. An easy way to work is to symlink the local copy of JSSImporter.py that is in your fork into your autopkglib folder (i.e. ln -sf /Library/AutoPkg/autopkglib/JSSImporter.py <this_repos_dir>). If you are using a different python-jss release, replace the copy in /Library/Application Support/JSSImporter.

If you want to build JSSImporter packages, we provide a makefile in the root of the repo. The build process is as follows:

  1. You need to install munkipkg, which is now used to do the packaging. For this, you need git installed on your Mac. After cloning munkipkg, it's easiest to create a symlink to /usr/local/bin so that it is in your path:

    git clone https://github.com/munki/munki-pkg.git
    chmod +x munki-pkg/munkipkg
    sudo ln -s /path/to/munki-pkg/munkipkg /usr/local/bin/munkipkg
    
  2. You need to clone the current python-jss into a folder at the same level as your JSSImporter folder:

    git clone https://github.com/jssimporter/python-jss.git
    
  3. You need pip. There is more than one way to install pip, but this should work:

    python -m ensurepip --user
    python -m pip install --upgrade pip --user
    
  4. Now you can build the package. Run. make from the root directory of the repo. The built package will be stored in the <repo>/pkg/jss folder.

    cd JSSImporter
    make
    

How JSSImporter is Installed

JSSImporter is available primarily as an Apple installer package, which installs the following:

  • JSSImporter.py is put into /Library/AutoPkg/autopkglib so AutoPkg can "find" it.
  • python-jss, which does all of the actual API calls, is put into /Library/Application Support/JSSImporter (folder name jss). JSSImporter inserts this path into the first entry of its python system path so that it will use the python-jss bundled in the installer package over any other instance.

In the past, python-jss was installed from the Python Packaging Index ("pip") like any other python package. This is a common practice for python developers, but can cause confusion when you're only interested in running AutoPkg. This made it easier to install the python requests module. Therefore, the decision was made to make a dedicated support folder for JSSImporter and use it for storing a copy of python-jss.

This can complicate casually testing upcoming JSSImporter or python-jss releases, but fear not. Read below...

I want to test a newer python-jss or JSSImporter

If you are interested in testing a newer version of either JSSImporter or python-jss, you can do so by cloning or downloading the testing branch desired from either project and copying them into the locations listed above in the "How JSSImporter is Installed" section.

JSSImporter will output its version, and that of python-jss, so verbose invocations of AutoPkg will include confirmation of the versions in use.

Python will look in the current working directory for imports before anything in the path, so if you're still seeing older versions listed, make sure you don't have a copy of python-jss in the /Library/AutoPkg/autopkglib folder.