Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc46175

Browse files
committed
Add --check-tkinter to setup.py. Install IDLE. Fixes #634078.
1 parent eb58f5d commit dc46175

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

Makefile.pre.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ memtest: all platform
530530
$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
531531

532532
# Install everything
533-
install: altinstall bininstall maninstall
533+
install: altinstall bininstall maninstall idleinstall
534534

535535
# Install almost everything without disturbing previous versions
536536
altinstall: altbininstall libinstall inclinstall libainstall \
@@ -826,6 +826,10 @@ frameworkinstallunixtools:
826826
$(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \
827827
srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../..
828828

829+
# This installs IDLE
830+
idleinstall:
831+
SRCDIR=$(srcdir) ./$(BUILDPYTHON) $(srcdir)/Tools/idle/setup.py install --check-tkinter
832+
829833
# Build the toplevel Makefile
830834
Makefile.pre: Makefile.pre.in config.status
831835
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,8 @@ Tools/Demos
582582
Build
583583
-----
584584

585+
- On Unix, IDLE is now installed automatically.
586+
585587
- The fpectl module is not built by default; it's dangerous or useless
586588
except in the hands of experts.
587589

Tools/idle/setup.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1-
import os,glob
1+
import os, glob, sys
22
from distutils.core import setup
33
from distutils.command.build_py import build_py
44
from distutils.command.install_lib import install_lib
55
import idlever
66

7+
try:
8+
pos = sys.argv.index("--check-tkinter")
9+
except ValueError:
10+
pass
11+
else:
12+
del sys.argv[pos]
13+
try:
14+
import _tkinter
15+
except ImportError:
16+
print >>sys.stderr, "Cannot install IDLE without _tkinter"
17+
raise SystemExit
18+
19+
try:
20+
package_dir = os.path.join(os.environ["SRCDIR"], "Tools", "idle")
21+
except KeyError:
22+
package_dir = "."
23+
724
# name of idle package
825
idlelib = "idlelib"
926

@@ -24,7 +41,8 @@ def run(self):
2441
outfile = self.get_plain_outfile(self.build_lib, [idlelib], name)
2542
dir = os.path.dirname(outfile)
2643
self.mkpath(dir)
27-
self.copy_file(name, outfile, preserve_mode = 0)
44+
self.copy_file(os.path.join(package_dir, name), outfile,
45+
preserve_mode = 0)
2846
for name in Icons:
2947
outfile = self.get_plain_outfile(self.build_lib,
3048
[idlelib,"Icons"], name)
@@ -35,7 +53,8 @@ def run(self):
3553

3654
def get_source_files(self):
3755
# returns the .py files, the .txt files, and the icons
38-
icons = [os.path.join("Icons",name) for name in Icons]
56+
icons = [os.path.join(package_dir, "Icons",name) for name in Icons]
57+
txts = [os.path.join(package_dir, name) for name in txt_files]
3958
return build_py.get_source_files(self)+txt_files+icons
4059

4160
def get_outputs(self, include_bytecode=1):
@@ -75,7 +94,7 @@ def _bytecode_filenames(self, files):
7594

7695
cmdclass = {'build_py':idle_build_py,
7796
'install_lib':idle_install_lib},
78-
package_dir = {idlelib:'.'},
97+
package_dir = {idlelib: package_dir},
7998
packages = [idlelib],
80-
scripts = ['idle']
99+
scripts = [os.path.join(package_dir, 'idle')]
81100
)

0 commit comments

Comments
 (0)