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 | for (dirpath, _dirname, files) in os.walk(sourcedir): |
|
25 | for (dirpath, _dirname, files) in os.walk(sourcedir): |
|
26 | for file in files: |
|
26 | for file in files: |
|
27 | source = pathlib.Path(dirpath) / file |
|
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 | print(source, destination) |
|
30 | print(source, destination) |
|
31 |
|
31 | ||
|
32 |
|
|
32 | os.makedirs(destination.parent, exist_ok=True) |
|
33 | # shutil.copytree(source.parent, destination.parent) |
|
33 | if destination.parent.is_dir() and not destination.parent.exists(): |
|
34 | os.mkdir(destination.parent) |
|
34 | os.mkdir(destination.parent) |
|
35 | elif source.is_dir() and not destination.exists(): |
|
35 | elif source.is_dir() and not destination.exists(): |
|
|
36 | print("Copying whole directory!") | ||
|
36 | shutil.copytree(source, destination) |
|
37 | shutil.copytree(source, destination) |
|
37 | else: |
|
38 | else: |
|
38 | shutil.copy2(source, destination) |
|
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 | shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe", |
|
43 | shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe", |
|
41 | pathlib.Path(new_name) / "isometric-park.exe") |
|
44 | pathlib.Path(new_name) / "isometric-park.exe") |
|
42 |
|
45 | ||
@@ -45,10 +48,11 | |||||
|
45 | with zipfile.ZipFile(new_zip_name, "w", |
|
48 | with zipfile.ZipFile(new_zip_name, "w", |
|
46 | #May be able to use something better on Linux: |
|
49 | #May be able to use something better on Linux: |
|
47 | compression=zipfile.ZIP_DEFLATED) as f: |
|
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 | for file in files: |
|
52 | for file in files: |
|
50 | source = pathlib.Path(dirpath) / file |
|
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 | def make_windows(suffix="new"): |
|
58 | def make_windows(suffix="new"): |
@@ -59,10 +63,11 | |||||
|
59 | for (dirpath, _dirname, files) in os.walk(sourcedir): |
|
63 | for (dirpath, _dirname, files) in os.walk(sourcedir): |
|
60 | for file in files: |
|
64 | for file in files: |
|
61 | source = pathlib.Path(dirpath) / file |
|
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 | print(source, destination) |
|
68 | print(source, destination) |
|
65 |
|
69 | ||
|
|
70 | os.makedirs(destination.parent, exist_ok=True) | ||
|
66 | if source.parent.is_dir() and not destination.parent.exists(): |
|
71 | if source.parent.is_dir() and not destination.parent.exists(): |
|
67 | # shutil.copytree(source.parent, destination.parent) |
|
72 | # shutil.copytree(source.parent, destination.parent) |
|
68 | os.mkdir(destination.parent) |
|
73 | os.mkdir(destination.parent) |
@@ -80,11 +85,10 | |||||
|
80 | #Windows doesn't natively support other formats |
|
85 | #Windows doesn't natively support other formats |
|
81 | #(besides uncompressed) in my testing: |
|
86 | #(besides uncompressed) in my testing: |
|
82 | compression=zipfile.ZIP_DEFLATED) as f: |
|
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 | for file in files: |
|
89 | for file in files: |
|
85 | source = pathlib.Path(dirpath) / file |
|
90 | source = pathlib.Path(dirpath) / file |
|
86 | print(source, destination ) |
|
91 | f.write(source, pathlib.Path(os.path.relpath(sourcedir, dirpath)) / os.path.relpath(dirpath, sourcedir) / pathlib.Path(file)) |
|
87 | f.write(source, os.path.relpath(sourcedir, dirpath)) |
|
||
|
88 |
|
92 | ||
|
89 |
|
93 | ||
|
90 | def make_macos(suffix="new"): |
|
94 | def make_macos(suffix="new"): |
@@ -146,6 +150,11 | |||||
|
146 | make_windows(sys.argv[2]) |
|
150 | make_windows(sys.argv[2]) |
|
147 | else: |
|
151 | else: |
|
148 | make_windows() |
|
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 | elif command.lower() == "source": |
|
158 | elif command.lower() == "source": |
|
150 | if len(sys.argv) > 2: |
|
159 | if len(sys.argv) > 2: |
|
151 | make_source(sys.argv[2]) |
|
160 | make_source(sys.argv[2]) |
You need to be logged in to leave comments.
Login now