Commit f39f59a5 authored by Kurt B. Kaiser's avatar Kurt B. Kaiser

Update the setup file:

1. Make it easier to change the package and script installation names.
2. Update the text files transferred to include the .def and new .txt
   files.
3. Update the description and long description, change email to
   python-dev, update the url to point at sourceforge.
4. Rename the build and install classes for clarity.
parent e1d18f52
...@@ -4,6 +4,8 @@ from distutils.command.build_py import build_py ...@@ -4,6 +4,8 @@ from distutils.command.build_py import build_py
from distutils.command.install_lib import install_lib from distutils.command.install_lib import install_lib
import idlever import idlever
idle_name = "idle"
try: try:
pos = sys.argv.index("--check-tkinter") pos = sys.argv.index("--check-tkinter")
except ValueError: except ValueError:
...@@ -17,17 +19,19 @@ else: ...@@ -17,17 +19,19 @@ else:
raise SystemExit raise SystemExit
try: try:
package_dir = os.path.join(os.environ["SRCDIR"], "Tools", "idle") package_dir = os.path.join(os.environ["SRCDIR"], "Tools", idle_name)
except KeyError: except KeyError:
package_dir = "." package_dir = "."
# name of idle package # name of package to be installed in site-packages
idlelib = "idlelib" pkgname = idle_name + "lib"
# the normal build_py would not incorporate the .txt files # the normal build_py would not incorporate the .txt or config files
txt_files = ['config-unix.txt','config-win.txt','config.txt', 'help.txt'] txt_files = ['extend.txt', 'help.txt', 'CREDITS.txt', 'LICENSE.txt']
txt_files += ['config-extensions.def', 'config-highlight.def',
'config-keys.def', 'config-main.def']
Icons = glob.glob1("Icons","*.gif") Icons = glob.glob1("Icons","*.gif")
class idle_build_py(build_py): class IDLE_Builder(build_py):
def get_plain_outfile(self, build_dir, package, file): def get_plain_outfile(self, build_dir, package, file):
# like get_module_outfile, but does not append .py # like get_module_outfile, but does not append .py
outfile_path = [build_dir] + list(package) + [file] outfile_path = [build_dir] + list(package) + [file]
...@@ -36,26 +40,26 @@ class idle_build_py(build_py): ...@@ -36,26 +40,26 @@ class idle_build_py(build_py):
def run(self): def run(self):
# Copies all .py files, then also copies the txt and gif files # Copies all .py files, then also copies the txt and gif files
build_py.run(self) build_py.run(self)
assert self.packages == [idlelib] assert self.packages == [pkgname]
for name in txt_files: for name in txt_files:
outfile = self.get_plain_outfile(self.build_lib, [idlelib], name) outfile = self.get_plain_outfile(self.build_lib, [pkgname], name)
dir = os.path.dirname(outfile) dir = os.path.dirname(outfile)
self.mkpath(dir) self.mkpath(dir)
self.copy_file(os.path.join(package_dir, name), outfile, self.copy_file(os.path.join(package_dir, name), outfile,
preserve_mode = 0) preserve_mode = 0)
for name in Icons: for name in Icons:
outfile = self.get_plain_outfile(self.build_lib, outfile = self.get_plain_outfile(self.build_lib,
[idlelib,"Icons"], name) [pkgname, "Icons"], name)
dir = os.path.dirname(outfile) dir = os.path.dirname(outfile)
self.mkpath(dir) self.mkpath(dir)
self.copy_file(os.path.join("Icons",name), self.copy_file(os.path.join("Icons", name),
outfile, preserve_mode = 0) outfile, preserve_mode = 0)
def get_source_files(self): def get_source_files(self):
# returns the .py files, the .txt files, and the icons # returns the .py files, the .txt and .def files, and the icons
icons = [os.path.join(package_dir, "Icons",name) for name in Icons] icons = [os.path.join(package_dir, "Icons",name) for name in Icons]
txts = [os.path.join(package_dir, name) for name in txt_files] txts = [os.path.join(package_dir, name) for name in txt_files]
return build_py.get_source_files(self)+txt_files+icons return build_py.get_source_files(self) + txt_files + icons
def get_outputs(self, include_bytecode=1): def get_outputs(self, include_bytecode=1):
# returns the built files # returns the built files
...@@ -64,42 +68,46 @@ class idle_build_py(build_py): ...@@ -64,42 +68,46 @@ class idle_build_py(build_py):
return outputs return outputs
for name in txt_files: for name in txt_files:
filename = self.get_plain_outfile(self.build_lib, filename = self.get_plain_outfile(self.build_lib,
[idlelib], name) [pkgname], name)
outputs.append(filename) outputs.append(filename)
for name in Icons: for name in Icons:
filename = self.get_plain_outfile(self.build_lib, filename = self.get_plain_outfile(self.build_lib,
[idlelib,"Icons"], name) [pkgname, "Icons"], name)
outputs.append(filename) outputs.append(filename)
return outputs return outputs
# Arghhh. install_lib thinks that all files returned from build_py's # Arghhh. install_lib thinks that all files returned from build_py's
# get_outputs are bytecode files # get_outputs are bytecode files
class idle_install_lib(install_lib): class IDLE_Installer(install_lib):
def _bytecode_filenames(self, files): def _bytecode_filenames(self, files):
files = [n for n in files if n.endswith('.py')] files = [n for n in files if n.endswith('.py')]
return install_lib._bytecode_filenames(self,files) return install_lib._bytecode_filenames(self, files)
setup(name="IDLE", setup(name="IDLEfork",
version = idlever.IDLE_VERSION, version = idlever.IDLE_VERSION,
description = "IDLE Fork, the Forked Python IDE", description = "IDLEfork, the Developmental Python IDE",
author = "Guido van Rossum", author = "Guido van Rossum et. al.",
author_email = "guido@python.org", author_email = "idle-dev@python.org",
#url = url = "https://sourceforge.net/projects/idlefork/",
long_description = long_description =
"""IDLE is a Tkinter based IDE for Python. It is written in 100% pure """IDLE is a Tkinter based IDE for Python. It is written in 100% pure Python
Python and works both on Windows and Unix. It features a multi-window and works both on Windows and Unix. It features a multi-window text editor with
text editor with multiple undo, Python colorizing, and many other things, multiple undo, Python colorizing, and many other things, as well as a Python
as well as a Python shell window and a debugger. shell window and a debugger.
IDLEfork is a separate line of development which was initiated by D. Scherer
at CMU as part of Visual Python. It features execution in a separate process
which is newly initiated for each run. At version 0.9 the RPC was changed to
incorporate code by GvR, which supports the debugger. IDLEfork also
incorporates a GUI configuration utilility. For further details, refer to
idlefork.sourceforge.net.
IDLE Fork is a separate line of development which was initiated by D. Scherer """,
at CMU as part of Visual Python. It features execution in a separate
process, with a fresh environment for each run. For further details,
refer to idlefork.sourceforge.net.""",
cmdclass = {'build_py':idle_build_py, cmdclass = {'build_py':IDLE_Builder,
'install_lib':idle_install_lib}, 'install_lib':IDLE_Installer},
package_dir = {idlelib: package_dir}, package_dir = {pkgname: package_dir},
packages = [idlelib], packages = [pkgname],
scripts = [os.path.join(package_dir, 'idle')] scripts = [os.path.join(package_dir, idle_name)]
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment