Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8628897

Browse files
committed
Completely revamped: it now uses separate instruction files per
distribution. Also, the user interface has been cleaned up a bit.
1 parent a662cf4 commit 8628897

3 files changed

Lines changed: 158 additions & 140 deletions

File tree

Mac/scripts/MkDistr.py

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
#
22
# Interactively decide what to distribute
33
#
4-
# The distribution type is signalled by a letter. The currently
5-
# defined letters are:
6-
# p PPC normal distribution
7-
# P PPC development distribution
8-
# m 68K normal distribution
9-
# M 68K development distribution
104
#
115
# The exclude file signals files to always exclude,
12-
# The pattern file records are of the form
13-
# ('pm', '*.c')
14-
# This excludes all files ending in .c for normal distributions.
6+
# The pattern file lines are of the form
7+
# *.c
8+
# This excludes all files ending in .c.
159
#
1610
# The include file signals files and directories to include.
1711
# Records are of the form
18-
# ('pPmM', 'Lib')
19-
# This includes the Lib dir in all distributions
20-
# ('pPmM', 'Tools:bgen:AE:AppleEvents.py', 'Lib:MacToolbox:AppleEvents.py')
21-
# This includes the specified file, putting it in the given place.
12+
# ('Tools:bgen:AE:AppleEvents.py', 'Lib:MacToolbox:AppleEvents.py')
13+
# This includes the specified file, putting it in the given place, or
14+
# ('Tools:bgen:AE:AppleEvents.py', None)
15+
# This excludes the specified file.
2216
#
2317
from MkDistr_ui import *
2418
import fnmatch
@@ -33,8 +27,7 @@
3327
class Matcher:
3428
"""Include/exclude database, common code"""
3529

36-
def __init__(self, type, filename):
37-
self.type = type
30+
def __init__(self, filename):
3831
self.filename = filename
3932
self.rawdata = []
4033
self.parse(filename)
@@ -55,25 +48,13 @@ def parse(self, dbfile):
5548
pat = self.parseline(d)
5649
self.rawdata.append(pat)
5750

58-
def parseline(self, line):
59-
try:
60-
data = eval(line)
61-
except:
62-
raise SyntaxError, line
63-
if type(data) <> type(()) or len(data) not in (2,3):
64-
raise SyntaxError, line
65-
if len(data) == 2:
66-
data = data + ('',)
67-
return data
68-
6951
def save(self):
7052
fp = open(self.filename, 'w')
71-
for d in self.rawdata:
72-
fp.write(`d`+'\n')
53+
self.savedata(fp, self.rawdata)
7354
self.modified = 0
7455

7556
def add(self, value):
76-
if len(value) == 2:
57+
if len(value) == 1:
7758
value = value + ('',)
7859
self.rawdata.append(value)
7960
self.rebuild1(value)
@@ -82,20 +63,20 @@ def add(self, value):
8263
def delete(self, value):
8364
key = value
8465
for i in range(len(self.rawdata)):
85-
if self.rawdata[i][1] == key:
66+
if self.rawdata[i][0] == key:
8667
del self.rawdata[i]
8768
self.unrebuild1(i, key)
8869
self.modified = 1
8970
return
9071
print 'Not found!', key
9172

9273
def getall(self):
93-
return map(lambda x: x[1], self.rawdata)
74+
return map(lambda x: x[0], self.rawdata)
9475

9576
def get(self, value):
96-
for t, src, dst in self.rawdata:
77+
for src, dst in self.rawdata:
9778
if src == value:
98-
return t, src, dst
79+
return src, dst
9980
print 'Not found!', value
10081

10182
def is_modified(self):
@@ -110,13 +91,28 @@ def rebuild(self):
11091
for v in self.rawdata:
11192
self.rebuild1(v)
11293

113-
def rebuild1(self, (tp, src, dst)):
114-
if self.type in tp:
115-
if dst == '':
116-
dst = src
117-
self.idict[src] = dst
94+
def parseline(self, line):
95+
try:
96+
data = eval(line)
97+
except:
98+
raise SyntaxError, line
99+
if type(data) <> type(()) or len(data) not in (1,2):
100+
raise SyntaxError, line
101+
if len(data) == 1:
102+
data = data + ('',)
103+
return data
104+
105+
def savedata(self, fp, data):
106+
for d in self.rawdata:
107+
fp.write(`d`+'\n')
108+
109+
def rebuild1(self, (src, dst)):
110+
if dst == '':
111+
dst = src
112+
if dst == None:
113+
self.edict[src] = None
118114
else:
119-
self.edict[src] = ''
115+
self.idict[src] = dst
120116

121117
def unrebuild1(self, num, src):
122118
if self.idict.has_key(src):
@@ -140,7 +136,7 @@ def match(self, patharg):
140136
# tack on our input filename
141137
if dstpath[-1] == os.sep:
142138
dir, file = os.path.split(path)
143-
dstpath = os.path.join(dstpath, path)
139+
dstpath = os.path.join(dstpath, file)
144140
return dstpath
145141
path, lastcomp = os.path.split(path)
146142
if not path:
@@ -172,13 +168,17 @@ def rebuild(self):
172168
for v in self.rawdata:
173169
self.rebuild1(v)
174170

175-
def rebuild1(self, (tp, src, dst)):
176-
if self.type in tp:
177-
pat = fnmatch.translate(src)
178-
self.relist.append(regex.compile(pat))
179-
else:
180-
self.relist.append(None)
181-
171+
def parseline(self, data):
172+
return (data, None)
173+
174+
def savedata(self, fp, data):
175+
for d in self.rawdata:
176+
fp.write(d[0]+'\n')
177+
178+
def rebuild1(self, (src, dst)):
179+
pat = fnmatch.translate(src)
180+
self.relist.append(regex.compile(pat))
181+
182182
def unrebuild1(self, num, src):
183183
del self.relist[num]
184184

@@ -200,10 +200,11 @@ def __init__(self):
200200
if not ok:
201201
sys.exit(0)
202202
os.chdir(fss.as_pathname())
203-
self.typedist = GetType()
204-
print 'TYPE', self.typedist
205-
self.inc = IncMatcher(self.typedist, '(MkDistr.include)')
206-
self.exc = ExcMatcher(self.typedist, '(MkDistr.exclude)')
203+
if not os.path.isdir(':(MkDistr)'):
204+
os.mkdir(':(MkDistr)')
205+
typedist = GetType()
206+
self.inc = IncMatcher(':(MkDistr):%s.include'%typedist)
207+
self.exc = ExcMatcher(':(MkDistr):%s.exclude'%typedist)
207208
self.ui = MkDistrUI(self)
208209
self.ui.mainloop()
209210

Mac/scripts/MkDistr.rsrc.hqx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
(This file must be converted with BinHex 4.0)
22

3-
:$%eV4'PcG()ZFR0bB`"bFh*M8P0&4!%!N!F&SINN!*!%!3!!!!5[!!!$V`!!!2)
3+
:$%eV4'PcG()ZFR0bB`"bFh*M8P0&4!%!N!F&Lh`-!*!%!3!!!!3X!!!$,!!!!9m
44
8T8SJ&+9+%"5P5rJ6'6!)%!!!#"!!!!J3!!!)%!!!#!a0Dd4TFh4b,R*cFQ0b!J!
5-
!!(*cFQ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