webtunnel/setup.py
David Soulayrol c5e61080f6 Initial commit
2022-06-24 14:00:54 +02:00

99 lines
3.6 KiB
Python
Executable file

#!/usr/bin/env python
# webTunnel.py. A simple mail tunnel to get web pages.
# Copyright (C) 2004 David Soulayrol <dsoulayrol@free.fr>
#
# This file is part of Webtunnel.py.
#
# webTunnel.py 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.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os, time
from distutils.core import setup
from distutils import log
from ground.util.dist import generate_and_install
VERSION = '0.3a'
HEADER = """
# webTunnel.py. A simple mail tunnel to get web pages.
# Copyright (C) 2004 David Soulayrol <dsoulayrol@free.fr>
#
# webTunnel.py 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.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Generated at install time
"""
# Redifine build_py of distutils.command.build_py so as to
# generate our configuration module on the fly.
class WebtunnelInstaller(generate_and_install):
def generate_conf(self):
outfile = os.path.sep.join(
['build', 'lib', 'webtunnel', 'conf', '__init__.py'])
log.info('generating configuration: ' + outfile)
if self.dry_run:
return
output = file(outfile, 'w')
output.write(HEADER)
output.write('VERSION = \'' + VERSION + ' (installed on ' + time.asctime() + ')\'\n')
path_to_data = os.path.sep.join(
[self.install_data, 'share', 'webtunnel'])
output.write('CONFIG_PATH = \'' + path_to_data + '\'\n')
path_to_configuration = os.path.join(path_to_data, 'webtunnel.conf')
output.write('CONFIG_FILE = \'' + path_to_configuration + '\'\n')
path_to_script = os.path.join(self.install_scripts, 'run_webtunnel.py')
output.write('PROGRAM_FILE = \'' + path_to_script + '\'\n')
path_to_libs = os.path.join(self.install_lib, 'webtunnel')
output.write('LIBS_PATH = \'' + path_to_libs + '\'\n')
output.close()
setup(
cmdclass = {'install': WebtunnelInstaller },
name = 'Webtunnel.py',
version = VERSION,
url='http://dsoulayrol.free.fr/soft/webtunnel.html',
description = 'A simple tool to surf the web by mail',
license = 'GPL http://www.gnu.org/copyleft/gpl.html',
author = 'David Soulayrol',
author_email = 'dsoulayrol@free.fr',
platforms = ['posix', 'cygwin'],
packages = ['webtunnel', 'webtunnel.conf', 'webtunnel.handlers'],
scripts = ['run_webtunnel.py'],
data_files=[('share/webtunnel',
['data/webtunnel.dtd', 'data/webtunnel.conf'])]
)