PiDP-8/I Software

dirs.py.in
Log In

File lib/pidp8i/dirs.py.in from the latest check-in


# -*- coding: utf-8 -*-
########################################################################
# dirs.py.in - Declare constants for directory names subbed in by
#   autosetup, partly so we don't have to do this in multiple modules
#   but also so that those files don't keep getting touched whenever
#   other *.in files get touched, thus forcing an OS/8 RK05 rebuild.
#
# Copyright © 2017 by Warren Young
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS LISTED ABOVE BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
# OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the names of the authors above
# shall not be used in advertising or otherwise to promote the sale,
# use or other dealings in this Software without prior written
# authorization from those authors.
########################################################################

import os

# Anchor directories.  These have to be statically defined for the
# development vs installation cases because chances are high that both
# trees exist on the disk, and these are absolute paths, so we can't
# just do a "path exists" test to determine which we should be using.
# So, autosetup subs in the proper values into the .py version of this
# file in the development tree and the install script overwrites these
# for the installation tree.
build = "@builddir@"
src   = "@abs_top_srcdir@"

# Derived directories.  Where it matters, these are the development tree
# paths, overridden or adjusted below if we're installed.
bin   = os.path.join (build, "bin/")
obj   = os.path.join (build, "obj/")
log   = os.path.join (build, "obj/")
media = os.path.join (src, "media/")
os8mi = os.path.join (media, "os8/")    # os8 media inputs
os8mo = bin                             # os8 media outputs

# Adjust paths for the "installed" case
if not os.path.exists(log):
    # The obj/ dir doesn't exist in the install tree
    log = "/tmp/"

if not os.path.exists(media):
    # We bury media one extra level deeper in the install tree
    media = media.replace('/media/', '/share/media/')

    # os8-run scripts output *.rk05 and *.tu56 into bin/ at build time.
    # At install time, they are moved to media/os8 directory.
    # If we're building or modifying the OS/8 media in the installation
    # tree, though, we need to write straight to the media directory.
    os8 = media