Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
997429a5
Kaydet (Commit)
997429a5
authored
Eyl 06, 2002
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
The script was very sloppy about which variables held source pathnames
and which held destination pathnames. Fixed.
üst
1f74ed8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
56 deletions
+54
-56
buildpkg.py
Mac/scripts/buildpkg.py
+54
-56
No files found.
Mac/scripts/buildpkg.py
Dosyayı görüntüle @
997429a5
...
...
@@ -53,6 +53,7 @@ __license__ = "FreeBSD"
import
os
,
sys
,
glob
,
fnmatch
,
shutil
,
string
,
copy
,
getopt
from
os.path
import
basename
,
dirname
,
join
,
islink
,
isdir
,
isfile
Error
=
"buildpkg.Error"
PKG_INFO_FIELDS
=
"""
\
Title
...
...
@@ -159,6 +160,7 @@ class PackageMaker:
# variables set later
self
.
packageRootFolder
=
None
self
.
packageResourceFolder
=
None
self
.
sourceFolder
=
None
self
.
resourceFolder
=
None
...
...
@@ -171,16 +173,25 @@ class PackageMaker:
"""
# set folder attributes
self
.
packageRoot
Folder
=
root
self
.
source
Folder
=
root
if
resources
==
None
:
self
.
packageResourceFolder
=
root
self
.
resourceFolder
=
root
else
:
self
.
resourceFolder
=
resources
# replace default option settings with user ones if provided
fields
=
self
.
packageInfoDefaults
.
keys
()
for
k
,
v
in
options
.
items
():
if
k
in
fields
:
self
.
packageInfo
[
k
]
=
v
elif
not
k
in
[
"OutputDir"
]:
raise
Error
,
"Unknown package option:
%
s"
%
k
# Check where we should leave the output. Default is current directory
outputdir
=
options
.
get
(
"OutputDir"
,
os
.
getcwd
())
packageName
=
self
.
packageInfo
[
"Title"
]
self
.
PackageRootFolder
=
os
.
path
.
join
(
outputdir
,
packageName
+
".pkg"
)
# do what needs to be done
self
.
_makeFolders
()
self
.
_addInfo
()
...
...
@@ -197,16 +208,11 @@ class PackageMaker:
# packageName = "%s-%s" % (self.packageInfo["Title"],
# self.packageInfo["Version"]) # ??
packageName
=
self
.
packageInfo
[
"Title"
]
rootFolder
=
packageName
+
".pkg"
contFolder
=
join
(
rootFolder
,
"Contents"
)
resourceFolder
=
join
(
contFolder
,
"Resources"
)
os
.
mkdir
(
rootFolder
)
contFolder
=
join
(
self
.
PackageRootFolder
,
"Contents"
)
self
.
packageResourceFolder
=
join
(
contFolder
,
"Resources"
)
os
.
mkdir
(
self
.
PackageRootFolder
)
os
.
mkdir
(
contFolder
)
os
.
mkdir
(
resourceFolder
)
self
.
resourceFolder
=
resourceFolder
os
.
mkdir
(
self
.
packageResourceFolder
)
def
_addInfo
(
self
):
"Write .info file containing installing options."
...
...
@@ -217,8 +223,8 @@ class PackageMaker:
for
f
in
string
.
split
(
PKG_INFO_FIELDS
,
"
\n
"
):
info
=
info
+
"
%
s
%%
(
%
s)s
\n
"
%
(
f
,
f
)
info
=
info
%
self
.
packageInfo
base
=
basename
(
self
.
packageRootFolder
)
+
".info"
path
=
join
(
self
.
r
esourceFolder
,
base
)
base
=
self
.
packageInfo
[
"Title"
]
+
".info"
path
=
join
(
self
.
packageR
esourceFolder
,
base
)
f
=
open
(
path
,
"w"
)
f
.
write
(
info
)
...
...
@@ -229,9 +235,9 @@ class PackageMaker:
# Currently ignores if the 'mkbom' tool is not available.
try
:
base
=
basename
(
self
.
packageRootFolder
)
+
".bom"
bomPath
=
join
(
self
.
r
esourceFolder
,
base
)
cmd
=
"mkbom
%
s
%
s"
%
(
self
.
packageRoot
Folder
,
bomPath
)
base
=
self
.
packageInfo
[
"Title"
]
+
".bom"
bomPath
=
join
(
self
.
packageR
esourceFolder
,
base
)
cmd
=
"mkbom
%
s
%
s"
%
(
self
.
source
Folder
,
bomPath
)
res
=
os
.
system
(
cmd
)
except
:
pass
...
...
@@ -244,23 +250,16 @@ class PackageMaker:
cwd
=
os
.
getcwd
()
packageRootFolder
=
self
.
packageRootFolder
try
:
# create archive
d
=
dirname
(
packageRootFolder
)
os
.
chdir
(
packageRootFolder
)
base
=
basename
(
packageRootFolder
)
+
".pax"
archPath
=
join
(
d
,
self
.
resourceFolder
,
base
)
cmd
=
"pax -w -f
%
s
%
s"
%
(
archPath
,
"."
)
res
=
os
.
system
(
cmd
)
# compress archive
cmd
=
"gzip
%
s"
%
archPath
res
=
os
.
system
(
cmd
)
except
:
pass
# create archive
os
.
chdir
(
self
.
sourceFolder
)
base
=
basename
(
self
.
packageInfo
[
"Title"
])
+
".pax"
self
.
archPath
=
join
(
self
.
packageResourceFolder
,
base
)
cmd
=
"pax -w -f
%
s
%
s"
%
(
self
.
archPath
,
"."
)
res
=
os
.
system
(
cmd
)
# compress archive
cmd
=
"gzip
%
s"
%
self
.
archPath
res
=
os
.
system
(
cmd
)
os
.
chdir
(
cwd
)
...
...
@@ -271,20 +270,22 @@ class PackageMaker:
# filenames. So, it's left to Installer.app to deal with the
# same file available in multiple formats...
if
not
self
.
packageR
esourceFolder
:
if
not
self
.
r
esourceFolder
:
return
# find candidate resource files (txt html rtf rtfd/ or lproj/)
allFiles
=
[]
for
pat
in
string
.
split
(
"*.txt *.html *.rtf *.rtfd *.lproj"
,
" "
):
pattern
=
join
(
self
.
packageR
esourceFolder
,
pat
)
pattern
=
join
(
self
.
r
esourceFolder
,
pat
)
allFiles
=
allFiles
+
glob
.
glob
(
pattern
)
# find pre-process and post-process scripts
# naming convention: packageName.{pre,post}-{upgrade,install}
# Alternatively the filenames can be {pre,post}-{upgrade,install}
# in which case we prepend the package name
packageName
=
self
.
packageInfo
[
"Title"
]
for
pat
in
(
"*upgrade"
,
"*install"
):
pattern
=
join
(
self
.
packageR
esourceFolder
,
packageName
+
pat
)
pattern
=
join
(
self
.
r
esourceFolder
,
packageName
+
pat
)
allFiles
=
allFiles
+
glob
.
glob
(
pattern
)
# check name patterns
...
...
@@ -292,22 +293,24 @@ class PackageMaker:
for
f
in
allFiles
:
for
s
in
(
"Welcome"
,
"License"
,
"ReadMe"
):
if
string
.
find
(
basename
(
f
),
s
)
==
0
:
files
.
append
(
f
)
files
.
append
(
(
f
,
f
)
)
if
f
[
-
6
:]
==
".lproj"
:
files
.
append
(
f
)
files
.
append
((
f
,
f
))
elif
f
in
[
"pre-upgrade"
,
"pre-install"
,
"post-upgrade"
,
"post-install"
]:
files
.
append
((
f
,
self
.
packageInfo
[
"Title"
]
+
"."
+
f
))
elif
f
[
-
8
:]
==
"-upgrade"
:
files
.
append
(
f
)
files
.
append
(
(
f
,
f
)
)
elif
f
[
-
8
:]
==
"-install"
:
files
.
append
(
f
)
files
.
append
(
(
f
,
f
)
)
# copy files
for
g
in
files
:
f
=
join
(
self
.
packageResourceFolder
,
g
)
for
src
,
dst
in
files
:
f
=
join
(
self
.
resourceFolder
,
src
)
if
isfile
(
f
):
shutil
.
copy
(
f
,
self
.
resourceFolder
)
shutil
.
copy
(
f
,
os
.
path
.
join
(
self
.
packageResourceFolder
,
dst
)
)
elif
isdir
(
f
):
# special case for .rtfd and .lproj folders...
d
=
join
(
self
.
resourceFolder
,
basename
(
f
)
)
d
=
join
(
self
.
packageResourceFolder
,
dst
)
os
.
mkdir
(
d
)
files
=
GlobDirectoryWalker
(
f
)
for
file
in
files
:
...
...
@@ -326,23 +329,18 @@ class PackageMaker:
installedSize
=
0
zippedSize
=
0
packageRootFolder
=
self
.
packageRootFolder
files
=
GlobDirectoryWalker
(
packageRootFolder
)
files
=
GlobDirectoryWalker
(
self
.
sourceFolder
)
for
f
in
files
:
numFiles
=
numFiles
+
1
installedSize
=
installedSize
+
os
.
stat
(
f
)[
6
]
installedSize
=
installedSize
+
os
.
l
stat
(
f
)[
6
]
d
=
dirname
(
packageRootFolder
)
base
=
basename
(
packageRootFolder
)
+
".pax.gz"
archPath
=
join
(
d
,
self
.
resourceFolder
,
base
)
try
:
zippedSize
=
os
.
stat
(
archPath
)[
6
]
zippedSize
=
os
.
stat
(
self
.
archPath
+
".gz"
)[
6
]
except
OSError
:
# ignore error
pass
base
=
basename
(
packageRootFolder
)
+
".sizes"
f
=
open
(
join
(
self
.
r
esourceFolder
,
base
),
"w"
)
format
=
"NumFiles
%
d
\n
InstalledSize
%
d
\n
CompressedSize
%
d"
base
=
self
.
packageInfo
[
"Title"
]
+
".sizes"
f
=
open
(
join
(
self
.
packageR
esourceFolder
,
base
),
"w"
)
format
=
"NumFiles
%
d
\n
InstalledSize
%
d
\n
CompressedSize
%
d
\n
"
f
.
write
(
format
%
(
numFiles
,
installedSize
,
zippedSize
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment