Răsfoiți Sursa

Merge remote-tracking branch 'upstream/master'

tobias47n9e 10 ani în urmă
părinte
comite
b626e0c7ae
4 a modificat fișierele cu 22 adăugiri și 3 ștergeri
  1. 2 0
      doc/examples.rst
  2. 16 0
      doc/faq.rst
  3. 2 1
      nsist/__init__.py
  4. 2 2
      nsist/copymodules.py

+ 2 - 0
doc/examples.rst

@@ -25,3 +25,5 @@ These may illustrate more complex uses of pynsist.
 - `Spreads <https://github.com/jbaiter/spreads/tree/windows>`_ is a book scanning tool,
   including a tkinter configuration system and a local webserver. Its use of
   pynsist (see ``buildmsi.py``) includes working with setuptools info files.
+- `InnStereo <https://github.com/tobias47n9e/innsbruck-stereographic>`_ is a GTK 3
+  application for geologists. Besides pygi, it uses numpy and matplotlib.

+ 16 - 0
doc/faq.rst

@@ -24,6 +24,22 @@ Python by default, though you can override this :ref:`in the config file <cfg_py
 Whichever method you use, compiled libraries must have the same bit-ness as
 the version of Python that's installed.
 
+Using data files
+----------------
+
+Applications often need data files along with their code. The easiest way to use
+data files with Pynsist is to store them in a Python package (a directory with
+a ``__init__.py`` file) you're creating for your application. They will be
+copied automatically, and modules in that package can locate them using
+``__file__`` like this::
+
+    data_file_path = os.path.join(os.path.dirname(__file__), 'file.dat')
+
+If you don't want to put data files inside a Python package, you will need to
+list them in the ``files`` key of the ``[Include]`` section of the config file.
+Your code can find them relative to the location of the launch script running your
+application (``sys.modules['__main__'].__file__``).
+
 Alternatives
 ------------
 

+ 2 - 1
nsist/__init__.py

@@ -89,7 +89,7 @@ class InstallerBuilder(object):
         self.shortcuts = shortcuts
         self.icon = icon
         self.packages = packages or []
-        self.exclude = exclude or []
+        self.exclude = [os.path.normpath(p) for p in (exclude or [])]
         self.extra_files = extra_files or []
         self.py_version = py_version
         if not self._py_version_pattern.match(py_version):
@@ -268,6 +268,7 @@ if __name__ == '__main__':
         ignored = set()
 
         # Filter by file names relative to the build directory
+        directory = os.path.normpath(directory)
         files = [os.path.join(directory, fname) for fname in files]
 
         # Execute all patterns

+ 2 - 2
nsist/copymodules.py

@@ -73,8 +73,8 @@ def copytree_ignore_callback(excludes, pkgdir, modname, directory, files):
 
     # Filter by file names relative to the build directory
     reldir = os.path.relpath(directory, pkgdir)
-    target = os.path.join('pkgs/', modname, reldir)
-    files = [os.path.join(target, fname) for fname in files]
+    target = os.path.join('pkgs', modname, reldir)
+    files = [os.path.normpath(os.path.join(target, fname)) for fname in files]
 
     # Execute all patterns
     for pattern in excludes + ['*.pyc']: