Skip to content

Commit 96e4733

Browse files
committed
Merge branch 'hotfix/0.6.10.1'
2 parents 51984ff + 995582a commit 96e4733

File tree

13 files changed

+99
-36
lines changed

13 files changed

+99
-36
lines changed

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
nuitka (0.6.10.1+ds-1) unstable; urgency=medium
2+
3+
* New upstream hotfix release.
4+
5+
-- Kay Hayen <kay.hayen@gmail.com> Sun, 13 Dec 2020 19:47:53 +0100
6+
17
nuitka (0.6.10+ds-1) unstable; urgency=medium
28

39
* New upstream release.

debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export PYBUILD_INTERPRETERS = python{version}
1111
# to cover, Debian 11 inheritance.
1212
DEB_VENDOR=$(shell dpkg-vendor --query vendor)
1313
ifeq ($(DEB_VENDOR), Debian)
14-
BUILD_ONLY_PYTHON3 := $(shell [ `lsb_release -r -s | sed -e s/unstable/11/ -e s/testing/11/` -ge 11 ] && echo true)
14+
BUILD_ONLY_PYTHON3 := $(shell [ `lsb_release -r -s | sed -e s/unstable/11/ -e s/testing/11/ -e 's/\..*//'` -ge 11 ] && echo true)
1515
else ifeq ($(DEB_VENDOR), Ubuntu)
1616
BUILD_ONLY_PYTHON3 := $(shell [ `lsb_release -r -s | sed -e 's/\.//' ` -ge 2004 ] && echo true)
1717
else

nuitka/MainControl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ def createNodeTree(filename):
142142
plugin_filename=module_filename, module_package=module_package
143143
)
144144

145+
# Allow plugins to add more modules based on the initial set being complete.
146+
Plugins.onModuleInitialSet()
147+
145148
# Then optimize the tree and potentially recursed modules.
146149
Optimization.optimize(main_module.getOutputFilename())
147150

nuitka/Version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""
2121

2222
version_string = """\
23-
Nuitka V0.6.10
23+
Nuitka V0.6.10.1
2424
Copyright (C) 2020 Kay Hayen."""
2525

2626

nuitka/build/SconsCaching.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@
2525
from collections import defaultdict
2626

2727
from nuitka.Tracing import scons_logger
28+
from nuitka.utils.AppDirs import getCacheDir
2829
from nuitka.utils.Download import getCachedDownload
2930
from nuitka.utils.Execution import getPythonInstallPathWindows
30-
from nuitka.utils.FileOperations import getLinkTarget, withFileLock
31+
from nuitka.utils.FileOperations import (
32+
getExternalUsePath,
33+
getLinkTarget,
34+
makePath,
35+
withFileLock,
36+
)
3137
from nuitka.utils.Utils import getOS, isWin32Windows
3238

3339
from .SconsUtils import (
@@ -172,6 +178,14 @@ def enableCcache(
172178
setEnvironmentVariable(env, "CCACHE_LOGFILE", ccache_logfile)
173179
env["CCACHE_LOGFILE"] = ccache_logfile
174180

181+
# Unless asked to do otherwise, store ccache files in our own directory.
182+
if "CCACHE_DIR" not in os.environ:
183+
ccache_dir = os.path.join(getCacheDir(), "ccache")
184+
makePath(ccache_dir)
185+
ccache_dir = getExternalUsePath(ccache_dir)
186+
setEnvironmentVariable(env, "CCACHE_DIR", ccache_dir)
187+
env["CCACHE_DIR"] = ccache_dir
188+
175189
# First check if it's not already supposed to be a ccache, then do nothing.
176190
cc_path = getExecutablePath(the_compiler, env=env)
177191

nuitka/build/static_src/HelpersRaising.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static void FORMAT_TYPE_ERROR1(PyObject **exception_type, PyObject **exception_v
3434
CHECK_OBJECT(*exception_value);
3535
}
3636

37+
#if PYTHON_VERSION >= 270
3738
static void FORMAT_TYPE_ERROR2(PyObject **exception_type, PyObject **exception_value, char const *format,
3839
char const *arg1, char const *arg2) {
3940
*exception_type = PyExc_TypeError;
@@ -42,6 +43,7 @@ static void FORMAT_TYPE_ERROR2(PyObject **exception_type, PyObject **exception_v
4243
*exception_value = Nuitka_String_FromFormat(format, arg1, arg2);
4344
CHECK_OBJECT(*exception_value);
4445
}
46+
#endif
4547

4648
#if PYTHON_VERSION < 266
4749
#define WRONG_EXCEPTION_TYPE_ERROR_MESSAGE "exceptions must be classes or instances, not %s"

nuitka/nodes/ModuleNodes.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def getUsedModules(self):
444444
return self.used_modules
445445

446446
def addUsedFunction(self, function_body):
447-
assert function_body in self.getFunctions()
447+
assert function_body in self.getFunctions(), function_body
448448

449449
assert (
450450
function_body.isExpressionFunctionBody()
@@ -815,7 +815,7 @@ def getPyIFilename(self):
815815
def _readPyPIFile(self):
816816
""" Read the .pyi file if present and scan for dependencies. """
817817

818-
# Complex stuff, pylint: disable=too-many-branches
818+
# Complex stuff, pylint: disable=too-many-branches,too-many-statements
819819

820820
if self.used_modules is None:
821821
pyi_filename = self.getPyIFilename()
@@ -840,18 +840,26 @@ def _readPyPIFile(self):
840840
assert parts[0] == "from"
841841
assert parts[2] == "import"
842842

843-
if parts[1] == "typing":
843+
origin_name = parts[1]
844+
845+
if origin_name == "typing":
844846
continue
845847

846-
pyi_deps.add(parts[1])
848+
if origin_name == ".":
849+
origin_name = self.getFullName()
850+
851+
# TODO: Might want to add full relative import handling.
852+
853+
if origin_name != self.getFullName():
854+
pyi_deps.add(origin_name)
847855

848856
imported = parts[3]
849857
if imported.startswith("("):
850858
# Handle multiline imports
851859
if not imported.endswith(")"):
852860
in_import = True
853861
imported = imported[1:]
854-
in_import_part = parts[1]
862+
in_import_part = origin_name
855863
assert in_import_part, (
856864
"Multiline part in file %s cannot be empty"
857865
% pyi_filename
@@ -867,7 +875,7 @@ def _readPyPIFile(self):
867875
for name in imported.split(","):
868876
if name:
869877
name = name.strip()
870-
pyi_deps.add(parts[1] + "." + name)
878+
pyi_deps.add(origin_name + "." + name)
871879

872880
else: # In import
873881
imported = line
@@ -890,6 +898,8 @@ def _readPyPIFile(self):
890898
def getUsedModules(self):
891899
self._readPyPIFile()
892900

901+
assert "." not in self.used_modules, self
902+
893903
return self.used_modules
894904

895905
def getParentModule(self):

nuitka/optimizations/TraceCollections.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
from nuitka import Tracing, Variables
2929
from nuitka.__past__ import iterItems # Python3 compatibility.
30+
from nuitka.containers.oset import OrderedSet
3031
from nuitka.importing.ImportCache import getImportedModuleByNameAndPath
3132
from nuitka.ModuleRegistry import addUsedModule
3233
from nuitka.nodes.NodeMakingHelpers import getComputationResult
@@ -601,7 +602,7 @@ def mergeMultipleBranches(self, collections):
601602
for collection in collections:
602603
for variable, version in iterItems(collection.variable_actives):
603604
if variable not in variable_versions:
604-
variable_versions[variable] = set([version])
605+
variable_versions[variable] = OrderedSet((version,))
605606
else:
606607
variable_versions[variable].add(version)
607608

nuitka/plugins/PluginBase.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,16 @@ def considerImplicitImports(self, module, signal_change):
162162

163163
full_name = ModuleName(full_name)
164164

165-
module_filename = self.locateModule(importing=module, module_name=full_name)
165+
try:
166+
module_filename = self.locateModule(
167+
importing=module, module_name=full_name
168+
)
169+
except Exception:
170+
self.warning(
171+
"Problem locating '%s' implicit imports '%s'."
172+
% (module.getFullName(), full_name)
173+
)
174+
raise
166175

167176
if module_filename is None:
168177
if Options.isShowInclusion():
@@ -429,6 +438,17 @@ def onModuleEncounter(self, module_filename, module_name, module_kind):
429438
# Virtual method, pylint: disable=no-self-use,unused-argument
430439
return None
431440

441+
def onModuleInitialSet(self):
442+
"""Provide extra modules to the initial root module set.
443+
444+
Args:
445+
None
446+
Returns:
447+
Iterable of modules, may yield.
448+
"""
449+
# Virtual method, pylint: disable=no-self-use
450+
return ()
451+
432452
@staticmethod
433453
def locateModule(importing, module_name):
434454
"""Provide a filename / -path for a to-be-imported module.

nuitka/plugins/Plugins.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,14 @@ def onModuleEncounter(module_filename, module_name, module_kind):
334334

335335
return result
336336

337+
@staticmethod
338+
def onModuleInitialSet():
339+
from nuitka.ModuleRegistry import addRootModule
340+
341+
for plugin in getActivePlugins():
342+
for module in plugin.onModuleInitialSet():
343+
addRootModule(module)
344+
337345
@staticmethod
338346
def considerFailedImportReferrals(module_name):
339347
for plugin in getActivePlugins():

nuitka/plugins/standard/MultiprocessingPlugin.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ class NuitkaPluginMultiprocessingWorkarounds(NuitkaPluginBase):
4444
"""
4545

4646
plugin_name = "multiprocessing"
47-
plugin_desc = "Required by Python's multiprocessing module"
48-
49-
def __init__(self):
50-
self.multiprocessing_added = False
47+
plugin_desc = "Required by Python's multiprocessing module on Windows"
5148

5249
@classmethod
5350
def isRelevant(cls):
@@ -112,9 +109,9 @@ def _reduce_compiled_method(m):
112109

113110
return None, None
114111

115-
@staticmethod
116-
def _addSlaveMainModule(root_module):
117-
from nuitka.ModuleRegistry import addRootModule
112+
def onModuleInitialSet(self):
113+
from nuitka.importing.ImportCache import addImportedModule
114+
from nuitka.ModuleRegistry import getRootTopModule
118115
from nuitka.plugins.Plugins import Plugins
119116
from nuitka.tree.Building import (
120117
CompiledPythonModule,
@@ -124,6 +121,8 @@ def _addSlaveMainModule(root_module):
124121

125122
# First, build the module node and then read again from the
126123
# source code.
124+
root_module = getRootTopModule()
125+
127126
module_name = ModuleName("__parents_main__")
128127
source_ref = root_module.getSourceReference()
129128

@@ -159,22 +158,13 @@ def _addSlaveMainModule(root_module):
159158
is_main=False,
160159
)
161160

162-
# This is an alternative entry point of course.
163-
addRootModule(slave_main_module)
161+
addImportedModule(imported_module=slave_main_module)
164162

165-
def onModuleEncounter(self, module_filename, module_name, module_kind):
166-
if module_name == "multiprocessing" and not self.multiprocessing_added:
167-
self.multiprocessing_added = True
168-
169-
from nuitka.ModuleRegistry import getRootModules
170-
171-
for root_module in getRootModules():
172-
if root_module.isMainModule():
173-
self._addSlaveMainModule(root_module)
174-
break
175-
else:
176-
assert False
163+
yield slave_main_module
177164

165+
def onModuleEncounter(self, module_filename, module_name, module_kind):
166+
# Enforce recursion in to multiprocessing for accelerated mode, which
167+
# would normally avoid this.
178168
if module_name.hasNamespace("multiprocessing"):
179169
return True, "Multiprocessing plugin needs this to monkey patch it."
180170

nuitka/utils/FileOperations.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def _getRealPathWindows(path):
153153
import subprocess
154154

155155
result = subprocess.check_output(
156-
"""powershell "Get-Item '%s' | Select-Object -ExpandProperty Target" """ % path
156+
"""powershell -NoProfile "Get-Item '%s' | Select-Object -ExpandProperty Target" """
157+
% path
157158
)
158159

159160
return os.path.join(os.path.dirname(path), result.rstrip("\r\n"))
@@ -497,7 +498,12 @@ def getWindowsShortPathName(filename):
497498
)
498499

499500
if output_buf_size >= needed:
500-
return output_buf.value
501+
# Short paths should be ASCII. Don't return unicode without a need,
502+
# as e.g. Scons hates that in environment variables.
503+
if str is bytes:
504+
return output_buf.value.encode("utf8")
505+
else:
506+
return output_buf.value
501507
else:
502508
output_buf_size = needed
503509

@@ -510,7 +516,7 @@ def getExternalUsePath(filename, only_dirname=False):
510516
Returns:
511517
Path that is a absolute and (on Windows) short filename pointing at the same file.
512518
Notes:
513-
Except on Windows, this is merely os.path.abspath, there is coverts
519+
This is only os.path.abspath except on Windows, where is coverts
514520
to a short path too.
515521
"""
516522

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ def get_script_args(dist, executable=os.path.normpath(sys.executable), wininst=F
227227
easy_install.get_script_args = get_script_args
228228

229229

230-
binary_suffix = "" if sys.version_info[0] == 2 else sys.version_info[0]
230+
if sys.version_info[0] == 2:
231+
binary_suffix = ""
232+
else:
233+
binary_suffix = "%d" % sys.version_info[0]
231234

232235
setup(
233236
name=project_name,

0 commit comments

Comments
 (0)