##// END OF EJS Templates
rust-cpython: mark all PyLeaked methods as unsafe...
rust-cpython: mark all PyLeaked methods as unsafe Unfortunately, these methods can be abused to obtain the inner 'static reference. The simplest (pseudo-code) example is: let leaked: PyLeaked<&'static _> = shared.leak_immutable(); let static_ref: &'static _ = &*leaked.try_borrow(py)?; // PyLeakedRef::deref() tries to bound the lifetime to itself, but // the underlying data is a &'static reference, so the returned // reference can be &'static. This problem can be easily fixed by coercing the lifetime, but there are many other ways to achieve that, and there wouldn't be a generic solution: let leaked: PyLeaked<&'static [_]> = shared.leak_immutable(); let leaked_iter: PyLeaked<slice::Iter<'static, _>> = unsafe { leaked.map(|v| v.iter()) }; let static_slice: &'static [_] = leaked_iter.try_borrow(py)?.as_slice(); So basically I failed to design the safe borrowing interface. Maybe we'll instead have to add much more restricted interface on top of the unsafe PyLeaked methods? For instance, Iterator::next() could be implemented if its Item type is not &'a (where 'a may be cheated.) Anyway, this seems not an easy issue, so it's probably better to leave the current interface as unsafe, and get broader comments while upstreaming this feature.

File last commit:

r43819:f2ef4f93 default
r44689:e960c30d default
Show More
readme.rst
71 lines | 2.6 KiB | text/x-rst | RstLexer
Gregory Szorc
wix: functionality to automate building WiX installers...
r42087 WiX Installer
=============
The files in this directory are used to produce an MSI installer using
the WiX Toolset (http://wixtoolset.org/).
The MSI installers require elevated (admin) privileges due to the
installation of MSVC CRT libraries into the Windows system store. See
the Inno Setup installers in the ``inno`` sibling directory for installers
that do not have this requirement.
Requirements
============
Building the WiX installers requires a Windows machine. The following
dependencies must be installed:
* Python 2.7 (download from https://www.python.org/downloads/)
* Microsoft Visual C++ Compiler for Python 2.7
(https://www.microsoft.com/en-us/download/details.aspx?id=44266)
Gregory Szorc
packaging: consolidate CLI functionality into packaging.py...
r43913 * Python 3.5+ (to run the ``packaging.py`` script)
Gregory Szorc
wix: functionality to automate building WiX installers...
r42087
Building
========
Gregory Szorc
packaging: consolidate CLI functionality into packaging.py...
r43913 The ``packaging.py`` script automates the process of producing an MSI
Gregory Szorc
wix: functionality to automate building WiX installers...
r42087 installer. It manages fetching and configuring non-system dependencies
(such as py2exe, gettext, and various Python packages).
The script requires an activated ``Visual C++ 2008`` command prompt.
A shortcut to such a prompt was installed with ``Microsoft Visual
C++ Compiler for Python 2.7``. From your Start Menu, look for
``Microsoft Visual C++ Compiler Package for Python 2.7`` then
launch either ``Visual C++ 2008 32-bit Command Prompt`` or
``Visual C++ 2008 64-bit Command Prompt``.
From the prompt, change to the Mercurial source directory. e.g.
``cd c:\src\hg``.
Gregory Szorc
packaging: consolidate CLI functionality into packaging.py...
r43913 Next, invoke ``packaging.py`` to produce an MSI installer. You will need
Gregory Szorc
wix: functionality to automate building WiX installers...
r42087 to supply the path to the Python interpreter to use.::
Gregory Szorc
packaging: consolidate CLI functionality into packaging.py...
r43913 $ python3 contrib\packaging\packaging.py \
wix --python c:\python27\python.exe
Gregory Szorc
wix: functionality to automate building WiX installers...
r42087
.. note::
The script validates that the Visual C++ environment is active and
that the architecture of the specified Python interpreter matches the
Visual C++ environment. An error is raised otherwise.
If everything runs as intended, dependencies will be fetched and
configured into the ``build`` sub-directory, Mercurial will be built,
and an installer placed in the ``dist`` sub-directory. The final line
of output should print the name of the generated installer.
Gregory Szorc
packaging: consolidate CLI functionality into packaging.py...
r43913 Additional options may be configured. Run ``packaging.py wix --help`` to
see a list of program flags.
Gregory Szorc
wix: functionality to automate building WiX installers...
r42087
Relationship to TortoiseHG
==========================
TortoiseHG uses the WiX files in this directory.
The code for building TortoiseHG installers lives at
https://bitbucket.org/tortoisehg/thg-winbuild and is maintained by
Steve Borho (steve@borho.org).
When changing behavior of the WiX installer, be sure to notify
the TortoiseHG Project of the changes so they have ample time
provide feedback and react to those changes.