annotate tests/test-status-inprocess.py @ 43564:d053d3f10b6a

packaging: stage installed files for Inno Previously, the Inno installer maintained its own mapping of source files to install location. (We have to maintain a similar mapping in the WiX installer.) Managing the explicit file layout for Windows packages is cumbersome and redundant. Every time you want to change the layout you need to change N locations. We frequently forget to do this and we only find out when people install Mercurial from our packages at release time. This commit starts the process of consolidating and simplifying the logic for managing the install layout on Windows. We introduce a list of install layout rules. These are simply source filenames (which can contain wildcards) and destination paths. The Inno packaging code has been updated to assemble all files into a staging directory that mirrors the final install layout. The list of files to add to the installer is derived by walking this staging directory and dynamically emitting the proper entries for the Inno Setup script. I diffed the file layout before and after this commit and there is no difference. Another benefit of this change is that it facilitates easier testing of the Windows install layout. Before, in order to test the final install layout, you needed to build an installer and run it. Now, you can stage files into the final layout and test from there, without running the installer. This should cut down on overhead when changing Windows code. Differential Revision: https://phab.mercurial-scm.org/D7159
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 23 Oct 2019 18:39:28 -0700
parents 2372284d9457
children c102b704edb5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28824
9d31582dd636 tests: use /usr/bin/env python for test-status-inprocess.py
timeless <timeless@mozdev.org>
parents: 28766
diff changeset
1 #!/usr/bin/env python
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
2 from __future__ import absolute_import, print_function
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
3
37945
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
4 import sys
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
5
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
6 from mercurial import (
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
7 commands,
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
8 localrepo,
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
9 ui as uimod,
28765
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
10 )
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
11
37945
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
12 print_ = print
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 39564
diff changeset
13
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 39564
diff changeset
14
37945
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
15 def print(*args, **kwargs):
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
16 """print() wrapper that flushes stdout buffers to avoid py3 buffer issues
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
17
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
18 We could also just write directly to sys.stdout.buffer the way the
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
19 ui object will, but this was easier for porting the test.
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
20 """
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
21 print_(*args, **kwargs)
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
22 sys.stdout.flush()
bbff7170f665 tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents: 37660
diff changeset
23
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 39564
diff changeset
24
30564
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28843
diff changeset
25 u = uimod.ui.load()
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
26
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
27 print('% creating repo')
39564
7ce9dea3a14a localrepo: move repo creation logic out of localrepository.__init__ (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37945
diff changeset
28 repo = localrepo.instance(u, b'.', create=True)
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
29
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
30 f = open('test.py', 'w')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
31 try:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
32 f.write('foo\n')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
33 finally:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
34 f.close
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
35
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
36 print('% add and commit')
37660
9dfa4e9ed45d py3: add b'' prefixes to tests/test-status-inprocess.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30564
diff changeset
37 commands.add(u, repo, b'test.py')
9dfa4e9ed45d py3: add b'' prefixes to tests/test-status-inprocess.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30564
diff changeset
38 commands.commit(u, repo, message=b'*')
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
39 commands.status(u, repo, clean=True)
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
40
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
41
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
42 print('% change')
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
43 f = open('test.py', 'w')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
44 try:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
45 f.write('bar\n')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
46 finally:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
47 f.close()
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
48
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
49 # this would return clean instead of changed before the fix
28843
2c7e6f363138 tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents: 28824
diff changeset
50 commands.status(u, repo, clean=True, modified=True)