/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/win32/brz-win32-bdist-postinstall.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 19:09:26 UTC
  • mfrom: (6622.1.36 breezy)
  • Revision ID: jelmer@jelmer.uk-20170521190926-5vtz8xaf0e9ylrpc
Merge rename to breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# (c) Canonical Ltd, 2006
2
 
# written by Alexander Belchenko for bzr project
 
2
# written by Alexander Belchenko for brz project
3
3
#
4
 
# This script will be executed after installation of bzrlib package
 
4
# This script will be executed after installation of breezy package
5
5
# and before installer exits.
6
6
# All printed data will appear on the last screen of installation
7
7
# procedure.
8
8
# The main goal of this script is to create special batch file
9
 
# launcher for bzr. Typical content of this batch file is:
10
 
#  @python bzr %*
 
9
# launcher for brz. Typical content of this batch file is:
 
10
#  @python brz %*
11
11
#
12
12
# This file works only on Windows 2000/XP. For win98 there is
13
13
# should be "%1 %2 %3 %4 %5 %6 %7 %8 %9" instead of "%*".
14
14
# Or even more complex thing.
15
15
#
16
 
# [bialix]: bzr de-facto does not support win98.
 
16
# [bialix]: brz de-facto does not support win98.
17
17
#           Although it seems to work on. Sometimes.
18
18
# 2006/07/30    added minimal support of win98.
19
19
# 2007/01/30    added *real* support of win98.
22
22
import sys
23
23
import _winreg
24
24
 
25
 
from bzrlib import win32utils
 
25
from breezy import win32utils
26
26
 
27
27
 
28
28
def _quoted_path(path):
41
41
if "-install" in sys.argv[1:]:
42
42
    # try to detect version number automatically
43
43
    try:
44
 
        import bzrlib
 
44
        import breezy
45
45
    except ImportError:
46
46
        ver = ''
47
47
    else:
48
 
        ver = bzrlib.__version__
 
48
        ver = breezy.__version__
49
49
 
50
50
    ##
51
51
    # XXX change message for something more appropriate
52
 
    print """Bazaar %s
 
52
    print """Breezy %s
53
53
 
54
 
Congratulation! Bzr successfully installed.
 
54
Congratulation! Brz successfully installed.
55
55
 
56
56
""" % ver
57
57
 
58
 
    batch_path = "bzr.bat"
 
58
    batch_path = "brz.bat"
59
59
    prefix = sys.exec_prefix
60
60
    try:
61
61
        ##
62
62
        # try to create
63
63
        scripts_dir = os.path.join(prefix, "Scripts")
64
 
        script_path = _quoted_path(os.path.join(scripts_dir, "bzr"))
 
64
        script_path = _quoted_path(os.path.join(scripts_dir, "brz"))
65
65
        python_path = _quoted_path(os.path.join(prefix, "python.exe"))
66
66
        args = _win_batch_args()
67
67
        batch_str = "@%s %s %s" % (python_path, script_path, args)
68
68
        # support of win98
69
 
        # if there is no HOME for bzr then set it for Bazaar manually
70
 
        base = os.environ.get('BZR_HOME', None)
 
69
        # if there is no HOME for brz then set it for Breezy manually
 
70
        base = os.environ.get('brz_HOME', None)
71
71
        if base is None:
72
72
            base = win32utils.get_appdata_location()
73
73
        if base is None:
74
74
            base = os.environ.get('HOME', None)
75
75
        if base is None:
76
76
            base = os.path.splitdrive(sys.prefix)[0] + '\\'
77
 
            batch_str = ("@SET BZR_HOME=" + _quoted_path(base) + "\n" +
 
77
            batch_str = ("@SET brz_HOME=" + _quoted_path(base) + "\n" +
78
78
                         batch_str)
79
79
 
80
 
        batch_path = os.path.join(scripts_dir, "bzr.bat")
 
80
        batch_path = os.path.join(scripts_dir, "brz.bat")
81
81
        f = file(batch_path, "w")
82
82
        f.write(batch_str)
83
83
        f.close()
86
86
        ##
87
87
        # inform user where batch launcher is.
88
88
        print "Created:", batch_path
89
 
        print "Use this batch file to run bzr"
 
89
        print "Use this batch file to run brz"
90
90
    except Exception, e:
91
91
        print "ERROR: Unable to create %s: %s" % (batch_path, e)
92
92
 
104
104
        # non-admin install - always goes in this user's start menu.
105
105
        fldr = get_special_folder_path("CSIDL_PROGRAMS")
106
106
 
107
 
    # make Bazaar entry
108
 
    fldr = os.path.join(fldr, 'Bazaar')
 
107
    # make Breezy entry
 
108
    fldr = os.path.join(fldr, 'Breezy')
109
109
    if not os.path.isdir(fldr):
110
110
        os.mkdir(fldr)
111
111
        directory_created(fldr)
112
112
 
113
113
    # link to documentation
114
 
    docs = os.path.join(sys.exec_prefix, 'Doc', 'Bazaar', 'index.html')
 
114
    docs = os.path.join(sys.exec_prefix, 'Doc', 'Breezy', 'index.html')
115
115
    dst = os.path.join(fldr, 'Documentation.lnk')
116
 
    create_shortcut(docs, 'Bazaar Documentation', dst)
 
116
    create_shortcut(docs, 'Breezy Documentation', dst)
117
117
    file_created(dst)
118
 
    print 'Documentation for Bazaar: Start => Programs => Bazaar'
 
118
    print 'Documentation for Breezy: Start => Programs => Breezy'
119
119
 
120
 
    # bzr in cmd shell
 
120
    # brz in cmd shell
121
121
    if os.name == 'nt':
122
122
        cmd = os.environ.get('COMSPEC', 'cmd.exe')
123
 
        args = "/K bzr help"
 
123
        args = "/K brz help"
124
124
    else:
125
125
        # minimal support of win98
126
126
        cmd = os.environ.get('COMSPEC', 'command.com')
127
 
        args = "bzr help"
128
 
    dst = os.path.join(fldr, 'Start bzr.lnk')
 
127
        args = "brz help"
 
128
    dst = os.path.join(fldr, 'Start brz.lnk')
129
129
    create_shortcut(cmd,
130
 
                    'Start bzr in cmd shell',
 
130
                    'Start brz in cmd shell',
131
131
                    dst,
132
132
                    args,
133
133
                    os.path.join(sys.exec_prefix, 'Scripts'))
134
134
    file_created(dst)
135
135
 
136
136
    # uninstall shortcut
137
 
    uninst = os.path.join(sys.exec_prefix, 'Removebzr.exe')
138
 
    dst = os.path.join(fldr, 'Uninstall Bazaar.lnk')
 
137
    uninst = os.path.join(sys.exec_prefix, 'Removebrz.exe')
 
138
    dst = os.path.join(fldr, 'Uninstall Breezy.lnk')
139
139
    create_shortcut(uninst,
140
 
                    'Uninstall Bazaar',
 
140
                    'Uninstall Breezy',
141
141
                    dst,
142
 
                    '-u bzr-wininst.log',
 
142
                    '-u brz-wininst.log',
143
143
                    sys.exec_prefix,
144
144
                    )
145
145
    file_created(dst)