-
Notifications
You must be signed in to change notification settings - Fork 5
/
unit_e_substituter.py
79 lines (68 loc) · 4.63 KB
/
unit_e_substituter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright (c) 2019 The Unit-e developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/licenses/MIT.
class UnitESubstituter:
"""
Logic for substituting strings in the unit-e codebase. This is needed when
changing substitutions in clonemachine. The UnitESubstituter then is used to
create the corresponding changes in the unit-e codebase, so that it's moved
from the version created by an older clonemachine to the version created by
the changed newer clonemachine.
"""
def substitute_naming(self, processor):
"""
Replace `UnitE` by `Unit-e` and `UnitE Core` by `unit-e`.
"""
processor.replace_recursively("unite core", "unit-e")
processor.replace_recursively("UnitE Core", "unit-e")
processor.replace_in_file("src/init.h", "UnitE core", "unit-e")
processor.replace_recursively("UnitE", "Unit-e")
processor.replace_recursively("unite address", "Unit-e address")
processor.replace_recursively("unite addresses", "Unit-e addresses")
processor.replace_recursively("unite transaction", "Unit-e transaction")
# Follow convention "BITCOIN" -> "UNIT-E" where dashes are allowed
processor.replace_in_file("doc/man/unite-cli.1", "UNITE-CLI", "UNIT-E-CLI")
processor.replace_in_file("doc/man/unite-qt.1", "UNITE-QT", "UNIT-E-QT")
processor.replace_in_file("doc/man/unite-cli.1", "UNITE-CLI", "UNIT-E-CLI")
processor.replace_in_file("doc/man/unite-tx.1", "UNITE-TX", "UNIT-E-TX")
processor.replace_in_file("doc/tor.md", "UNITE", "UNIT-E")
# Handle special cases
processor.replace_in_file("doc/zmq.md", "UnitEd", "The unit-e daemon")
processor.replace_in_file("test/functional/wallet_labels.py", "UnitEs", "UTEs")
processor.replace_in_file("test/functional/rpc_signmessage.py",
"expected_signature = 'HzSnrVR/sJC1Rg4SQqeecq9GAmIFtlj1u87aIh5i6Mi1bEkm7b+bsI7pIKWJsRZkjAQRkKhcTTYuVJAl0bmdWvY='",
"expected_signature = 'IBn0HqnF0UhqTgGOiEaQouMyisWG4AOVQS+OJwVXGF2eK+11/YswSl3poGNeDLqYcNIIfTxMMy7o3XfEnxozgIM='")
# Has already been removed. It's only here to satisfy the tests
processor.replace_in_file("doc/shared-libraries.md", "NUnitE", "NUnit-e")
# Has already been fixed. It's only here to satisfy the tests
processor.replace_in_file("src/util.cpp", '.find("unit-e")', '.find("Unit-e")')
processor.replace_in_file("src/util.cpp", 'strPrefix + "The Bitcoin Core developers";',
'strPrefix + "The Unit-e developers";')
processor.replace_in_file('configure.ac', 'COPYRIGHT_HOLDERS_SUBSTITUTION,[[unit-e]])',
'COPYRIGHT_HOLDERS_SUBSTITUTION,[[Unit-e]])')
def substitute_urls(self, processor):
processor.replace_recursively("github.com/unite/bips", "github.com/bitcoin/bips")
processor.replace_recursively("github.com/unite/unite", "github.com/bitcoin/bitcoin")
processor.replace_in_file("contrib/devtools/README.md", "unite/unite", "dtr-org/unit-e")
processor.replace_in_file_regex("src/protocol.h",
r"https://unite.org/en/developer-reference#(\w+)",
r"https://docs.unit-e.io/reference/p2p/\1.html")
processor.replace_recursively("www.unite.org", "unit-e.io")
processor.replace_recursively("unite.org", "bitcoin.org")
def substitute_executables(self, processor):
processor.apply_recursively(lambda path: processor.git_move_file(path, "united", "unit-e"))
processor.replace_recursively('united', 'unit_e', match_before="_")
processor.replace_recursively('united', 'unit_e', match_after="_")
processor.replace_recursively('united', 'unit-e')
processor.replace_recursively('UNITED', 'UNIT_E')
processor.replace_recursively('uniteds', 'unit-e daemons')
processor.apply_recursively(lambda path: processor.git_move_file(path, "unite-cli", "unit-e-cli"))
processor.git_move_file("test/functional/interface_unite_cli.py", "unite_cli", "unit_e_cli")
processor.replace_recursively('unite-cli', 'unit-e-cli')
processor.replace_recursively('unite_cli', 'unit_e_cli')
processor.replace_recursively('UNITECLI', 'UNIT_E_CLI')
processor.apply_recursively(lambda path: processor.git_move_file(path, "unite-tx", "unit-e-tx"))
processor.replace_recursively('unite-tx', 'unit-e-tx')
processor.replace_recursively('unite_tx', 'unit_e_tx')
processor.replace_recursively('UNITETX', 'UNIT_E_TX')
processor.replace_recursively('unite.conf', 'unit-e.conf')