Commit 3da0e550 authored by sumpfralle's avatar sumpfralle

fixed a compatibility issue with Python2.5

don't add the windows installer script for default packages on other platforms


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1068 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 126e6bb9
...@@ -27,10 +27,25 @@ import distutils.sysconfig ...@@ -27,10 +27,25 @@ import distutils.sysconfig
import glob import glob
import os.path import os.path
import sys import sys
import shutil
# add the local pycam source directory to the PYTHONPATH # add the local pycam source directory to the PYTHONPATH
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src")) BASE_DIR = os.path.realpath(os.path.abspath(os.path.dirname(__file__)))
sys.path.insert(0, os.path.join(BASE_DIR, "src"))
from pycam import VERSION from pycam import VERSION
WINDOWS_START_SCRIPT = "pycam-loader.py"
DEFAULT_START_SCRIPT = "pycam"
# we don't want to include the windows postinstall script in other installers
is_windows_installer = "bdist_wininst" in sys.argv
if is_windows_installer:
shutil.copy2(os.path.join(BASE_DIR, DEFAULT_START_SCRIPT),
os.path.join(BASE_DIR, WINDOWS_START_SCRIPT))
PLATFORM_SCRIPTS = [WINDOWS_START_SCRIPT, "pycam_win32_postinstall.py"]
else:
PLATFORM_SCRIPTS = [DEFAULT_START_SCRIPT]
setup( setup(
name="pycam", name="pycam",
...@@ -80,7 +95,7 @@ Windows: select Python 2.5 in the following dialog. ...@@ -80,7 +95,7 @@ Windows: select Python 2.5 in the following dialog.
"pycam.Toolpath", "pycam.Toolpath",
"pycam.Utils", "pycam.Utils",
], ],
scripts = ['pycam-loader.py', 'pycam_win32_postinstall.py'], scripts = PLATFORM_SCRIPTS,
data_files=[("share/pycam/doc", [ data_files=[("share/pycam/doc", [
"COPYING.TXT", "COPYING.TXT",
"INSTALL.TXT", "INSTALL.TXT",
...@@ -95,4 +110,7 @@ Windows: select Python 2.5 in the following dialog. ...@@ -95,4 +110,7 @@ Windows: select Python 2.5 in the following dialog.
], ],
) )
if is_windows_installer:
os.remove(os.path.join(BASE_DIR, WINDOWS_START_SCRIPT))
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
...@@ -1084,11 +1084,15 @@ class Rectangle(TransformableContainer): ...@@ -1084,11 +1084,15 @@ class Rectangle(TransformableContainer):
if len(unique_vertices) != 2: if len(unique_vertices) != 2:
log.error("Invalid number of vertices: %s" % unique_vertices) log.error("Invalid number of vertices: %s" % unique_vertices)
return None return None
if abs(unique_vertices[0].sub(unique_vertices[1]).norm - shared_vertices[0].sub(shared_vertices[1]).norm) < epsilon: if abs(unique_vertices[0].sub(unique_vertices[1]).norm - \
shared_vertices[0].sub(shared_vertices[1]).norm) < epsilon:
try: try:
return Rectangle(unique_vertices[0], unique_vertices[1], shared_vertices[0], shared_vertices[1], normal=t1.normal) return Rectangle(unique_vertices[0], unique_vertices[1],
shared_vertices[0], shared_vertices[1],
normal=t1.normal)
except ValueError: except ValueError:
log.warn("Triangles not combined: %s, %s" % (unique_vertices, shared_vertices)) log.warn("Triangles not combined: %s, %s" % (unique_vertices,
shared_vertices))
return None return None
else: else:
return None return None
...@@ -1121,7 +1125,8 @@ class Rectangle(TransformableContainer): ...@@ -1121,7 +1125,8 @@ class Rectangle(TransformableContainer):
log.error("Unexpected corner count: %s / %s / %s" % (r1, r2, corners)) log.error("Unexpected corner count: %s / %s / %s" % (r1, r2, corners))
return None return None
try: try:
return Rectangle(*corners, normal=r1.normal) return Rectangle(corners[0], corners[1], corners[2], corners[3],
normal=r1.normal)
except ValueError: except ValueError:
log.error("No valid rectangle found: %s" % corners) log.error("No valid rectangle found: %s" % corners)
return None return None
......
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