Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Tcl/tk files added to the package #3

Open
wants to merge 1 commit into
base: rogii-v3.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions cmake/build_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ if(WIN32)
WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/.."
)
execute_process(
COMMAND
7z.exe a -r -tzip ../python37.zip *.pyc -x!__pycache__ -x!test -x!ensurepip -x!idlelib -x!venv -x!tests -x!tkinter -x!turtle* -aou
WORKING_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/../Lib"
)
file(
COPY
python37.zip
Expand Down Expand Up @@ -174,6 +168,15 @@ if(WIN32)
DESTINATION
"${ROOT}/${PACKAGE_NAME}/bin"
)
file(
COPY
externals/tcltk-8.6.9.0/${FOLDER_ARCH}/lib/tcl8.6
externals/tcltk-8.6.9.0/${FOLDER_ARCH}/lib/tk8.6
externals/tcltk-8.6.9.0/${FOLDER_ARCH}/lib/tix8.4.3
DESTINATION
"${ROOT}/${PACKAGE_NAME}/tcl"
)

elseif(UNIX)
execute_process(
COMMAND
Expand Down
40 changes: 40 additions & 0 deletions mkstd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
import compileall
import zipfile
import os

compileall.compile_dir('Lib',force=True,legacy=True,optimize=2)

from Lib.lib2to3.pgen2.driver import main as grammar_gen

grammar_gen('Lib/lib2to3/Grammar.txt','Lib/lib2to3/PatternGrammar.txt')

missed_dir = [
'__pycache__','test','ensurepip','idlelib','venv','tests','turtledemo','pydoc-data','site-packages'
]
missed_file = [
'turtle.pyc'
]

def allow_ext(fname):
_, ext = os.path.splitext(fname)
return ext in ('.pyc','.pickle','.pem')

zf = zipfile.ZipFile("python37.zip", "w", zipfile.ZIP_DEFLATED, True, 9)

os.chdir("Lib")

for dirname, subdirs, files in os.walk('.'):
for p in dirname.split(os.path.sep):
if p in missed_dir:
break
else:
dirname = dirname[2:]
print(dirname)
not_saved = bool(dirname)
for filename in files:
if allow_ext(filename) and filename not in missed_file:
if not_saved:
not_saved = False
zf.write(dirname)
zf.write(os.path.join(dirname, filename))

os.chdir("..")

zf.close()
14 changes: 14 additions & 0 deletions package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,30 @@ if(WIN32)
${PYTHON_BINDIR}/_sqlite3.pyd
${PYTHON_BINDIR}/_ssl.pyd
${PYTHON_BINDIR}/_tkinter.pyd
${PYTHON_BINDIR}/_queue.pyd
${PYTHON_BINDIR}/pyshellext.dll
${PYTHON_BINDIR}/sqlite3.dll
${PYTHON_BINDIR}/tcl86t.dll
${PYTHON_BINDIR}/tk86t.dll
${PYTHON_BINDIR}/libcrypto-1_1.dll
${PYTHON_BINDIR}/libssl-1_1.dll
${PYTHON_BINDIR}/python.exe
DESTINATION
.
COMPONENT
CNPM_RUNTIME
EXCLUDE_FROM_ALL
)
install(
DIRECTORY
tcl
DESTINATION
python
COMPONENT
CNPM_RUNTIME
EXCLUDE_FROM_ALL
)

elseif(UNIX)
set_target_properties(
Python::library
Expand Down