浏览代码

avoid hidden import, make it easy for pyinstaller

this fixes #218 in an easier way so one doesn't have to type
--hidden-import=logging.config all the time when using pyinstaller.
Thomas Waldmann 9 年之前
父节点
当前提交
234a88bec6
共有 3 个文件被更改,包括 6 次插入2 次删除
  1. 1 1
      Vagrantfile
  2. 4 0
      borg/logger.py
  3. 1 1
      docs/development.rst

+ 1 - 1
Vagrantfile

@@ -237,7 +237,7 @@ def build_binary_with_pyinstaller(boxname)
     cd /vagrant/borg
     . borg-env/bin/activate
     cd borg
-    pyinstaller -F -n borg.exe --distpath=/vagrant/borg --clean --hidden-import=logging.config borg/__main__.py
+    pyinstaller -F -n borg.exe --distpath=/vagrant/borg --clean borg/__main__.py
   EOF
 end
 

+ 4 - 0
borg/logger.py

@@ -33,6 +33,10 @@ The way to use this is as follows:
 import inspect
 import logging
 
+# make it easy for PyInstaller (it does not discover the dependency on this
+# module automatically, because it is lazy-loaded by logging, see #218):
+import logging.config
+
 
 def setup_logging(stream=None):
     """setup logging module according to the arguments provided

+ 1 - 1
docs/development.rst

@@ -129,7 +129,7 @@ When using the Vagrant VMs, pyinstaller will already be installed.
 With virtual env activated::
 
   pip install pyinstaller>=3.0  # or git checkout master
-  pyinstaller -F -n borg-PLATFORM --hidden-import=logging.config borg/__main__.py
+  pyinstaller -F -n borg-PLATFORM borg/__main__.py
   for file in dist/borg-*; do gpg --armor --detach-sign $file; done
 
 If you encounter issues, see also our `Vagrantfile` for details.