8000 remove dead code and practice · winpython/winpython@2dd302e · GitHub
[go: up one dir, main page]

Skip to content

Commit 2dd302e

Browse files
committed
remove dead code and practice
1 parent 47329e3 commit 2dd302e

File tree

1 file changed

+0
-80
lines changed

1 file changed

+0
-80
lines changed

winpython/utils.py

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -683,86 +683,6 @@ def get_source_package_infos(fname):
683683
return match.groups()[:2]
684684

685685

686-
def build_wininst(
687-
root,
688-
python_exe=None,
689-
copy_to=None,
690-
architecture=None,
691-
verbose=False,
692-
installer='bdist_wininst',
693-
):
694-
"""Build wininst installer from Python package located in *root*
695-
and eventually copy it to *copy_to* folder.
696-
Return wininst installer full path."""
697-
if python_exe is None:
698-
python_exe = sys.executable
699-
assert Path(python_exe).is_file()
700-
cmd = [python_exe, 'setup.py', 'build']
701-
if architecture is not None:
702-
archstr = (
703-
'win32' if architecture == 32 else 'win-amd64'
704-
)
705-
cmd += [f'--plat-name={archstr}']
706-
cmd += [installer]
707-
# root = a tmp dir in windows\tmp,
708-
if verbose:
709-
subprocess.call(cmd, cwd=root)
710-
else:
711-
p = subprocess.Popen(
712-
cmd,
713-
cwd=root,
714-
stdout=subprocess.PIPE,
715-
stderr=subprocess.PIPE,
716-
)
717-
p.communicate()
718-
p.stdout.close()
719-
p.stderr.close()
720-
distdir = str(Path(root) / 'dist')
721-
if not Path(distdir).is_dir():
722-
raise RuntimeError(
723-
"Build failed: see package README file for further"
724-
" details regarding installation requirements.\n\n"
725-
"For more concrete debugging infos, please try to build "
726-
"the package from the command line:\n"
727-
"1. Open a WinPython command prompt\n"
728-
"2. Change working directory to the appropriate folder\n"
729-
"3. Type `python setup.py build install`"
730-
)
731-
pattern = WININST_PATTERN.replace(
732-
r'(win32|win\-amd64)', archstr
733-
)
734-
for distname in os.listdir(distdir):
735-
match = re.match(pattern, distname)
736-
if match is not None:
737-
break
738-
# for wheels (winpython here)
739-
match = re.match(SOURCE_PATTERN, distname)
740-
if match is not None:
741-
break
742-
match = re.match(WHEELBIN_PATTERN, distname)
743-
if match is not None:
744-
break
745-
else:
746-
raise RuntimeError(
747-
f"Build failed: not a pure Python package? {distdir}"
748-
)
749-
src_fname = str(Path(distdir) / distname)
750-
if copy_to is None:
751-
return src_fname
752-
else:
753-
dst_fname = str(Path(copy_to) / distname)
754-
shutil.move(src_fname, dst_fname)
755-
if verbose:
756-
print(
757-
(
758-
f"Move: {src_fname} --> {dst_fname}"
759-
)
760-
)
761-
# remove tempo dir 'root' no more needed
762-
shutil.rmtree(root, onerror=onerror)
763-
return dst_fname
764-
765-
766686
def buildflit_wininst(
767687
root,
768688
python_exe=None,

0 commit comments

Comments
 (0)
0