Update of /cvsroot/tmda/tmda/contrib/cgi
In directory sc8-pr-cvs1:/tmp/cvs-serv16449

Added Files:
        compile 
Log Message:
compile replaces the old Makefile I used to use to compile tmda-cgi.  This new
program is more sophisticated and checks the environment variable TMDARC to see
if the user has relocated their configuration files.  compile generalizes
based on any value it finds in TMDARC.


--- NEW FILE ---
#!/usr/bin/env python

# Copyright (C) 2002 Gre7g Luterman <[EMAIL PROTECTED]>
#
# This file is part of TMDA.
#
# TMDA is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  A copy of this license should
# be included in the file COPYING.
#
# TMDA is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with TMDA; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

import os
import string
import sys

# Create dirs.h
F = open("dirs.h", "w")
F.write("""#define PYTHON "%s"
#define INSTALL "%s"
""" % (sys.executable, os.getcwd()))
if os.environ.has_key("TMDARC"):
  TMDARC = \
    string.replace(os.environ["TMDARC"], "/%s/" % os.environ["USER"], "/~/")
  F.write("""#define TMDARC "%s"
""" % TMDARC)
  print """NOTE: User configuration files have been relocated by setting TMDARC.
tmda-cgi will look for config files at: %s
Where <user> will be replaced by the user's login name.
""" % string.replace(os.environ["TMDARC"], "/%s/" % os.environ["USER"],
    "/<user>/")
F.close()

# Remove any old tmda-rc
try:
  os.unlink("tmda-cgi")
except: pass

# Compile tmda-cgi
os.system("gcc tmda-cgi.c -o tmda-cgi")

# Remove dirs.h
os.unlink("dirs.h")

# Build no-su?
if (len(sys.argv) > 1) and (sys.argv[1] == "no-su"):
  os.chmod("tmda-cgi", 0755)
else:
  os.chmod("tmda-cgi", 04755)

print "Compilation done."

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to