Description:
Work on Linux support (work from a while ago).
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -25,18 +25,21 | |||
|
25 | 25 | for (dirpath, _dirname, files) in os.walk(sourcedir): |
|
26 | 26 | for file in files: |
|
27 | 27 | source = pathlib.Path(dirpath) / file |
|
28 |
destination = pathlib.Path(new_name) / os.path.relpath( |
|
|
28 | destination = pathlib.Path(new_name) / os.path.relpath(dirpath, sourcedir) / pathlib.Path(file) | |
|
29 | 29 | |
|
30 | 30 | print(source, destination) |
|
31 | 31 | |
|
32 |
|
|
|
33 | # shutil.copytree(source.parent, destination.parent) | |
|
32 | os.makedirs(destination.parent, exist_ok=True) | |
|
33 | if destination.parent.is_dir() and not destination.parent.exists(): | |
|
34 | 34 | os.mkdir(destination.parent) |
|
35 | 35 | elif source.is_dir() and not destination.exists(): |
|
36 | print("Copying whole directory!") | |
|
36 | 37 | shutil.copytree(source, destination) |
|
37 | 38 | else: |
|
38 | 39 | shutil.copy2(source, destination) |
|
39 | 40 | |
|
41 | print(pathlib.Path(new_name) / "isometric-park-fna.exe", | |
|
42 | pathlib.Path(new_name) / "isometric-park.exe") | |
|
40 | 43 | shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe", |
|
41 | 44 | pathlib.Path(new_name) / "isometric-park.exe") |
|
42 | 45 | |
@@ -45,10 +48,11 | |||
|
45 | 48 | with zipfile.ZipFile(new_zip_name, "w", |
|
46 | 49 | #May be able to use something better on Linux: |
|
47 | 50 | compression=zipfile.ZIP_DEFLATED) as f: |
|
48 |
for (dirpath, _dirname, files) in os.walk( |
|
|
51 | for (dirpath, _dirname, files) in os.walk(new_name): | |
|
49 | 52 | for file in files: |
|
50 | 53 | source = pathlib.Path(dirpath) / file |
|
51 | f.write(source) | |
|
54 | f.write(source, pathlib.Path(os.path.relpath(sourcedir, dirpath)) / os.path.relpath(dirpath, sourcedir) / pathlib.Path(file)) | |
|
55 | # f.write(source, pathlib.Path(os.path.relpath(sourcedir, dirpath)) / os.path.relpath(dirpath, sourcedir) / pathlib.Path(file)) | |
|
52 | 56 | |
|
53 | 57 | |
|
54 | 58 | def make_windows(suffix="new"): |
@@ -59,10 +63,11 | |||
|
59 | 63 | for (dirpath, _dirname, files) in os.walk(sourcedir): |
|
60 | 64 | for file in files: |
|
61 | 65 | source = pathlib.Path(dirpath) / file |
|
62 |
destination = pathlib.Path(new_name) / os.path.relpath( |
|
|
66 | destination = pathlib.Path(new_name) / os.path.relpath(dirpath, sourcedir) / pathlib.Path(file) | |
|
63 | 67 | |
|
64 | 68 | print(source, destination) |
|
65 | 69 | |
|
70 | os.makedirs(destination.parent, exist_ok=True) | |
|
66 | 71 | if source.parent.is_dir() and not destination.parent.exists(): |
|
67 | 72 | # shutil.copytree(source.parent, destination.parent) |
|
68 | 73 | os.mkdir(destination.parent) |
@@ -80,11 +85,10 | |||
|
80 | 85 | #Windows doesn't natively support other formats |
|
81 | 86 | #(besides uncompressed) in my testing: |
|
82 | 87 | compression=zipfile.ZIP_DEFLATED) as f: |
|
83 |
for (dirpath, _dirname, files) in os.walk( |
|
|
88 | for (dirpath, _dirname, files) in os.walk(new_name): | |
|
84 | 89 | for file in files: |
|
85 | 90 | source = pathlib.Path(dirpath) / file |
|
86 | print(source, destination ) | |
|
87 | f.write(source, os.path.relpath(sourcedir, dirpath)) | |
|
91 | f.write(source, pathlib.Path(os.path.relpath(sourcedir, dirpath)) / os.path.relpath(dirpath, sourcedir) / pathlib.Path(file)) | |
|
88 | 92 | |
|
89 | 93 | |
|
90 | 94 | def make_macos(suffix="new"): |
@@ -146,6 +150,11 | |||
|
146 | 150 | make_windows(sys.argv[2]) |
|
147 | 151 | else: |
|
148 | 152 | make_windows() |
|
153 | elif command.lower() == "linux": | |
|
154 | if len(sys.argv) > 2: | |
|
155 | make_linux(sys.argv[2]) | |
|
156 | else: | |
|
157 | make_linux() | |
|
149 | 158 | elif command.lower() == "source": |
|
150 | 159 | if len(sys.argv) > 2: |
|
151 | 160 | make_source(sys.argv[2]) |
You need to be logged in to leave comments.
Login now