From 182f39876a96c632ce5aff185f96d3d92d2c6e53 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Tue, 9 Feb 2021 09:18:30 +0000 Subject: [PATCH] Moved deps directories to separate stl deps from views deps. --- scripts/deps.py | 2 +- scripts/exports.py | 7 ++++++- scripts/plateup.py | 9 ++++++--- scripts/views.py | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/deps.py b/scripts/deps.py index 0f50fa3..6239915 100644 --- a/scripts/deps.py +++ b/scripts/deps.py @@ -34,7 +34,7 @@ def read_deps(dname): for line in lines: if line.startswith('\t'): dep = line[1 : -1].rstrip(' \\').replace('\\ ', ' ') - if not os.path.basename(dep) in ['stl.scad', 'dxf.scad', 'svf.scad', 'png.scad', 'target.scad'] and not '/stls/' in dep and not '/dxfs/' in dep: + if not os.path.basename(dep) in ['stl.scad', 'dxf.scad', 'svf.scad', 'png.scad', 'target.scad']: deps.append(dep) return deps diff --git a/scripts/exports.py b/scripts/exports.py index 0a46c70..bd34a5e 100644 --- a/scripts/exports.py +++ b/scripts/exports.py @@ -29,6 +29,7 @@ import time import times from deps import * import json +import shutil def bom_to_parts(bom_dir, part_type, assembly = None): # @@ -62,12 +63,16 @@ def make_parts(target, part_type, parts = None): # top_dir = set_config(target, lambda: usage(part_type)) target_dir = top_dir + part_type + 's' - deps_dir = top_dir + "deps" + deps_dir = target_dir + "/deps" bom_dir = top_dir + "bom" if not os.path.isdir(target_dir): os.makedirs(target_dir) if not os.path.isdir(deps_dir): os.makedirs(deps_dir) + + if os.path.isdir(top_dir + '/deps'): #old location + shutil.rmtree(top_dir + '/deps') + times.read_times(target_dir) # # Decide which files to make diff --git a/scripts/plateup.py b/scripts/plateup.py index 6e5caf5..3c0444b 100644 --- a/scripts/plateup.py +++ b/scripts/plateup.py @@ -26,7 +26,7 @@ import sys import c14n_stl from set_config import * from deps import * -from shutil import copyfile +import shutil import re source_dirs = { "stl" : "platters", "dxf" : "panels" } @@ -54,9 +54,12 @@ def plateup(target, part_type, usage = None): # # Make the deps dir # - deps_dir = dir + "/deps" + deps_dir = parts_dir + "/deps" if not os.path.isdir(deps_dir): os.makedirs(deps_dir) + + if os.path.isdir(dir + '/deps'): #old deps + shutil.rmtree(dir + '/deps') # # Decide which files to make # @@ -100,7 +103,7 @@ def plateup(target, part_type, usage = None): dst = target_dir + '/' + file if mtime(src) > mtime(dst): print("Copying %s to %s" % (src, dst)) - copyfile(src, dst) + shutil.copyfile(src, dst) copied.append(file) # # Remove any cruft diff --git a/scripts/views.py b/scripts/views.py index 46a1304..91080a9 100755 --- a/scripts/views.py +++ b/scripts/views.py @@ -130,7 +130,7 @@ def views(target, do_assemblies = None): # top_dir = set_config(target, usage) target_dir = top_dir + 'assemblies' - deps_dir = top_dir + "deps" + deps_dir = target_dir + "/deps" bom_dir = top_dir + "bom" if not os.path.isdir(target_dir): os.makedirs(target_dir)