Compare commits

...

4 commits

Author SHA1 Message Date
Jeff Epler
2ae33dc4e8 remove various debug statements 2005-06-14 16:29:40 +00:00
Jeff Epler
80683d35d8 these removed files already existed in ../setup/
they should not be here, because then they will be installed
and could mess up future users of 'distutils'
2005-06-13 15:55:00 +00:00
Jeff Epler
ecf4daa555 include a command ("install") in the message printed when environment
variables are needed for setup.py to run
2005-06-13 15:41:51 +00:00
Jeff Epler
17f4249d06 parse the "ldd" output a little more robustly. "fenn"'s system has these two
lines of output:
         linux-gate.so.1 =>  (0xffffe000)
         /lib/ld-linux.so.2 (0x80000000)
the first one happened to parse OK already, but the second one did not.
2005-06-13 15:40:45 +00:00
7 changed files with 5 additions and 240 deletions

View file

@ -1,92 +0,0 @@
from distutils.command.build_py import build_py as _build_py
from distutils import sysconfig
import os
from glob import glob
import yapps
class build_py(_build_py):
def check_package (self, package, package_dir):
# Empty dir name means current directory, which we can probably
# assume exists. Also, os.path.exists and isdir don't know about
# my "empty string means current dir" convention, so we have to
# circumvent them.
if package_dir != "":
if not os.path.exists(package_dir):
raise DistutilsFileError, \
"package directory '%s' does not exist" % package_dir
if not os.path.isdir(package_dir):
raise DistutilsFileError, \
("supposed package directory '%s' exists, " +
"but is not a directory") % package_dir
# Require __init__.py for all but the "root package"
if package:
init_py = os.path.join(package_dir, "__init__.g")
if os.path.isfile(init_py):
return init_py
init_py = os.path.join(package_dir, "__init__.py")
if os.path.isfile(init_py):
return init_py
log.warn(("package init file '%s' not found " +
"(or not a regular file)"), init_py)
# Either not in a package at all (__init__.py not expected), or
# __init__.py doesn't exist -- so don't return the filename.
return None
def find_package_modules (self, package, package_dir):
modules = _build_py.find_package_modules(self, package, package_dir)
yapps_module_files = glob(os.path.join(package_dir, "*.g"))
for f in yapps_module_files:
module = os.path.splitext(os.path.basename(f))[0]
modules.append((package, module, f))
return modules
def build_module(self, module, module_file, package):
if isinstance(package, str):
package = package.split(".")
elif isinstance(package, (list,tuple)):
raise TypeError, \
"'package' must be a string (dot-separated), list, or tuple"
if module_file.endswith(".g"):
outfile = self.get_module_outfile(self.build_lib, package, module)
yapps.generate(module_file, outfile)
self.announce("building %s -> %s" % (module_file, outfile))
else:
return _build_py.build_module(self, module, module_file, package)
def run(self):
# XXX copy_file by default preserves atime and mtime. IMHO this is
# the right thing to do, but perhaps it should be an option -- in
# particular, a site administrator might want installed files to
# reflect the time of installation rather than the last
# modification time before the installed release.
# XXX copy_file by default preserves mode, which appears to be the
# wrong thing to do: if a file is read-only in the working
# directory, we want it to be installed read/write so that the next
# installation of the same module distribution can overwrite it
# without problems. (This might be a Unix-specific issue.) Thus
# we turn off 'preserve_mode' when copying to the build directory,
# since the build directory is supposed to be exactly what the
# installation will look like (ie. we preserve mode when
# installing).
# Dispose of an "unusual" case first: no pure Python modules
# at all (no problem, just return silently)
if not self.py_modules and not self.packages:
return
if self.py_modules:
self.build_modules()
if self.packages:
self.build_packages()
self.byte_compile(self.get_outputs(include_bytecode=0))
# vim:ts=8:sts=4:et:

View file

@ -1,80 +0,0 @@
__all__ = ['build_scripts', 'WINDOWED', 'TERMINAL']
from distutils.command.build_scripts import build_scripts
from distutils.dep_util import newer
from distutils.util import convert_path
from distutils import sysconfig
import re, os, sys
# check if Python is called on the first line with this expression
first_line_re = re.compile(r'^#!.*python[0-9.]*(\s+.*)?$')
class build_scripts(build_scripts):
def copy_scripts (self):
"""Copy each script listed in 'self.scripts'; if it's marked as a
Python script in the Unix way (first line matches 'first_line_re',
ie. starts with "\#!" and contains "python"), then adjust the first
line to refer to the current Python interpreter as we copy.
"""
self.mkpath(self.build_dir)
scripts = []
for install_as, script in self.scripts.items():
adjust = 0
script = convert_path(script)
outfile = os.path.join(self.build_dir, install_as)
if not self.force and not newer(script, outfile):
self.announce("not copying %s (up-to-date)" % script)
continue
# Always open the file, but ignore failures in dry-run mode --
# that way, we'll get accurate feedback if we can read the
# script.
try:
f = open(script, "r")
except IOError:
if not self.dry_run:
raise
f = None
else:
first_line = f.readline()
if not first_line:
self.warn("%s is an empty file (skipping)" % script)
continue
match = first_line_re.match(first_line)
if match:
adjust = 1
post_interp = match.group(1) or ''
if adjust:
self.announce("copying and adjusting %s -> %s" %
(script, self.build_dir))
if not self.dry_run:
outf = open(outfile, "w")
if not sysconfig.python_build:
outf.write("#!%s%s\n" %
(os.path.normpath(sys.executable),
post_interp))
else:
outf.write("#!%s%s" %
(os.path.join(
sysconfig.get_config_var("BINDIR"),
"python" + sysconfig.get_config_var("EXE")),
post_interp))
outf.writelines(f.readlines())
outf.close()
if f:
f.close()
else:
f.close()
self.copy_file(script, outfile)
def WINDOWED(s):
if os.name == "nt": return "%s.pyw" % s
return s
def TERMINAL(s):
if os.name == "nt": return "%s.py" % s
return s
# vim:ts=8:sts=4:et:

View file

@ -44,7 +44,6 @@ class GLCanon(Translated, ArcsToSegmentsMixin):
def select_plane(self, arg): pass
def get_tool(self, tool):
print "get_tool", tool
return tool, .75, .0625
def straight_traverse_translated(self, x,y,z, a,b,c):

View file

@ -38,7 +38,6 @@ class ArcsToSegmentsMixin:
self.plane = plane
def arc_feed(self, x1, y1, cx, cy, rot, z1, a, b, c):
print "arc_feed", self.plane
if self.plane == 1:
f = n = [x1,y1,z1, a, b, c]
xyz = [0,1,2]

View file

@ -60,7 +60,6 @@ import nf; nf.start(root_window)
import gcode
try:
root_window.tk.call("proc", "_", "s", "set s")
nf.source_lib_tcl(root_window,"axis.nf")
nf.source_lib_tcl(root_window,"axis.tcl")
except TclError:
@ -314,43 +313,6 @@ def init():
glClearColor(0,0,0,0)
glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
def draw_small_origin():
r = 2.0;
glColor3f(0.0,1.0,1.0)
glBegin(GL_LINE_STRIP)
for i in range(37):
theta = (i*10)*math.pi/180.0
glVertex3f(r*cos(theta),r*sin(theta),0.0)
glEnd()
glBegin(GL_LINE_STRIP)
for i in range(37):
theta = (i*10)*math.pi/180.0
glVertex3f(0.0, r*cos(theta), r*sin(theta))
glEnd()
glBegin(GL_LINE_STRIP)
for i in range(37):
theta = (i*10)*math.pi/180.0
glVertex3f(r*cos(theta),0.0, r*sin(theta))
glEnd()
glBegin(GL_LINES);
glVertex3f(-r, -r, 0.0)
glVertex3f( r, r, 0.0)
glVertex3f(-r, r, 0.0)
glVertex3f( r, -r, 0.0)
glVertex3f(-r, 0.0, -r)
glVertex3f( r, 0.0, r)
glVertex3f(-r, 0.0, r)
glVertex3f( r, 0.0, -r)
glVertex3f(0.0, -r, -r)
glVertex3f(0.0, r, r)
glVertex3f(0.0, -r, r)
glVertex3f(0.0, r, -r)
glEnd()
def draw_axes():
glBegin(GL_LINES);
@ -626,10 +588,8 @@ def ensure_mode(m):
class AxisCanon(GLCanon):
def get_tool(self, tool):
print tool, len(s.tool_table)
for t in s.tool_table:
if t[0] == tool:
print tool, t
return t
return tool,0.,0.
@ -977,7 +937,6 @@ class TclCommands(nf.TclCommands):
widgets.mdi_history.insert("end", "%s\n" % command)
widgets.mdi_history.configure(state="disabled")
c.mdi(command)
o.tkRedraw()
def redraw(*ignored):
o.tkRedraw()
@ -998,18 +957,6 @@ class TclCommands(nf.TclCommands):
if not manual_ok(): return
ensure_mode(emc.MODE_MANUAL)
c.home("xyzabc".index(vars.current_axis.get()))
def set_axis_offset(event=None):
if not manual_ok(): return
ensure_mode(emc.MODE_MDI)
offset_axis = "xyzabc".index(vars.current_axis.get())
s.poll()
actual_position = s.actual_position[offset_axis]
offset_command = "g10 L2 p1 %c%9.4f\n" % (vars.current_axis.get(), actual_position)
print offset_command
c.mdi(offset_command)
ensure_mode(emc.MODE_MANUAL)
s.poll()
o.tkRedraw()
def brake(event=None):
if not manual_ok(): return
ensure_mode(emc.MODE_MANUAL)
@ -1122,7 +1069,6 @@ root_window.bind("#", commands.toggle_coord_type)
# c: continuous
# i: incremental
root_window.bind("<Home>", commands.home_axis)
root_window.bind("<Shift-Home>", commands.set_axis_offset)
widgets.mdi_history.bind("<Configure>", "%W see {end - 1 lines}")
def jog(*args):
@ -1196,8 +1142,6 @@ if len(sys.argv) > 1 and sys.argv[1] == '-ini':
jog_speed = float(inifile.find("TRAJ", "DEFAULT_VELOCITY"))
widgets.feedoverride.configure(to=max_feed_override)
emc.nmlfile = inifile.find("EMC", "NML_FILE")
vars.coord_type.set(inifile.find("DISPLAY", "POSITION_OFFSET") == "RELATIVE")
vars.display_type.set(inifile.find("DISPLAY", "POSITION_FEEDBACK") == "COMMANDED")
del sys.argv[1:3]
opts, args = getopt.getopt(sys.argv[1:], 'd:')
for i in range(len(axisnames), 6):
@ -1278,15 +1222,9 @@ def redraw(self):
glCallList(cone_program)
glPopMatrix()
if vars.show_live_plot.get() or vars.show_program.get():
s.poll()
glPushMatrix()
glScalef(1/25.4, 1/25.4, 1/25.4)
if vars.coord_type.get() and (s.origin[0] or s.origin[1] or s.origin[2]):
draw_small_origin()
glTranslatef(s.origin[0]*25.4, s.origin[1]*25.4, s.origin[2]*25.4)
draw_axes()
else:
draw_axes()
draw_axes()
glPopMatrix()

View file

@ -39,7 +39,7 @@ if emcroot is None:
setup.py failed to locate the root directory of your emc installation.
Determine the location of your emc installation and re-run setup.py with a
commandline like this:
$ env EMCROOT=/usr/local/emc python setup.py
$ env EMCROOT=/usr/local/emc python setup.py install
See the README file for more information.
"""
@ -49,10 +49,10 @@ if emcplat is None:
print """\
setup.py failed to locate the (non-realtime) platform of your emc installation.
Determine the platform name and re-run setup.py with a commandline like this:
$ env PLAT=nonrealtime python setup.py
$ env PLAT=nonrealtime python setup.py install
If you had to specify EMCSOURCEDIR, the commandline would look like
$ env EMCSOURCEDIR=/usr/local/emc PLAT=nonrealtime python setup.py
$ env EMCSOURCEDIR=/usr/local/emc PLAT=nonrealtime python setup.py install
See the README file for more information.
"""

View file

@ -28,6 +28,7 @@ def get_togl_flags():
tk_library = None
lddinfo = commands.getoutput("ldd %s" % _tkinter.__file__)
tkinterlibs = [line.strip().split(" => ") for line in lddinfo.split("\n")]
tkinterlibs = [i for i in tkinterlibs if len(i) == 2]
for l, m in tkinterlibs:
m = m.split("(")[0].strip()
add_if_exists(lib_dirs, os.path.join(m, ".."))