Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: tools/create_tarball.py

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/create_debian_packages.py ('k') | tools/cxx_wrapper.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file 3 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 # Script to build a tarball of the Dartino source. 8 # Script to build a tarball of the Dartino source.
9 # 9 #
10 # The tarball includes all the source needed to build Dartino. This 10 # The tarball includes all the source needed to build Dartino. This
(...skipping 15 matching lines...) Expand all
26 import optparse 26 import optparse
27 import sys 27 import sys
28 import tarfile 28 import tarfile
29 from os import listdir 29 from os import listdir
30 from os.path import join, split, abspath 30 from os.path import join, split, abspath
31 31
32 import utils 32 import utils
33 33
34 34
35 HOST_OS = utils.GuessOS() 35 HOST_OS = utils.GuessOS()
36 FLETCH_DIR = abspath(join(__file__, '..', '..')) 36 DARTINO_DIR = abspath(join(__file__, '..', '..'))
37 # The repository directory where dartino, dart and third_party are located. 37 # The repository directory where dartino, dart and third_party are located.
38 REPO_DIR = abspath(join(__file__, '..', '..', '..')) 38 REPO_DIR = abspath(join(__file__, '..', '..', '..'))
39 # Flags. 39 # Flags.
40 verbose = False 40 verbose = False
41 41
42 # Name of the dartino directory when unpacking the tarball. 42 # Name of the dartino directory when unpacking the tarball.
43 versiondir = '' 43 versiondir = ''
44 44
45 # Ignore Git/SVN files, checked-in binaries, backup files, etc. 45 # Ignore Git/SVN files, checked-in binaries, backup files, etc.
46 # 46 #
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 original_name = tar_info.name[len(REPO_DIR):] 80 original_name = tar_info.name[len(REPO_DIR):]
81 _, tail = split(original_name) 81 _, tail = split(original_name)
82 if tail in ignoredDirs: 82 if tail in ignoredDirs:
83 return None 83 return None
84 for path in ignoredPaths: 84 for path in ignoredPaths:
85 if original_name.startswith(path): 85 if original_name.startswith(path):
86 return None 86 return None
87 for ending in ignoredEndings: 87 for ending in ignoredEndings:
88 if original_name.endswith(ending): 88 if original_name.endswith(ending):
89 return None 89 return None
90 # Add the fletch directory name with version. Place the debian 90 # Add the dartino directory name with version. Place the debian
91 # directory one level over the rest which are placed in the 91 # directory one level over the rest which are placed in the
92 # directory 'fletch'. This enables building the Debian packages 92 # directory 'dartino'. This enables building the Debian packages
93 # out-of-the-box. 93 # out-of-the-box.
94 tar_info.name = join(versiondir, original_name) 94 tar_info.name = join(versiondir, original_name)
95 if verbose: 95 if verbose:
96 print 'Adding %s as %s' % (original_name, tar_info.name) 96 print 'Adding %s as %s' % (original_name, tar_info.name)
97 return tar_info 97 return tar_info
98 98
99 def GenerateCopyright(filename): 99 def GenerateCopyright(filename):
100 with open(join(FLETCH_DIR, 'LICENSE.md')) as lf: 100 with open(join(DARTINO_DIR, 'LICENSE.md')) as lf:
101 license_lines = lf.readlines() 101 license_lines = lf.readlines()
102 102
103 with open(filename, 'w') as f: 103 with open(filename, 'w') as f:
104 f.write('Name: dartino\n') 104 f.write('Name: dartino\n')
105 f.write('Maintainer: Dartino Team <misc@dartino.org>\n') 105 f.write('Maintainer: Dartino Team <misc@dartino.org>\n')
106 f.write('Source: https://github.com/dartino/sdk/\n') 106 f.write('Source: https://github.com/dartino/sdk/\n')
107 f.write('License:\n') 107 f.write('License:\n')
108 for line in license_lines: 108 for line in license_lines:
109 f.write(' %s' % line) # Line already contains trailing \n. 109 f.write(' %s' % line) # Line already contains trailing \n.
110 110
(...skipping 12 matching lines...) Expand all
123 123
124 124
125 def CreateTarball(tarfilename): 125 def CreateTarball(tarfilename):
126 global ignoredPaths # Used for adding the output directory. 126 global ignoredPaths # Used for adding the output directory.
127 # Generate the name of the tarfile 127 # Generate the name of the tarfile
128 version = utils.GetVersion() 128 version = utils.GetVersion()
129 global versiondir 129 global versiondir
130 versiondir = 'dartino-%s' % version 130 versiondir = 'dartino-%s' % version
131 debian_dir = 'tools/linux_dist_support/debian' 131 debian_dir = 'tools/linux_dist_support/debian'
132 # Don't include the build directory in the tarball (ignored paths 132 # Don't include the build directory in the tarball (ignored paths
133 # are relative to FLETCH_DIR). 133 # are relative to DARTINO_DIR).
134 builddir = utils.GetBuildDir(HOST_OS) 134 builddir = utils.GetBuildDir(HOST_OS)
135 ignoredPaths.append(builddir) 135 ignoredPaths.append(builddir)
136 136
137 print 'Creating tarball: %s' % tarfilename 137 print 'Creating tarball: %s' % tarfilename
138 with tarfile.open(tarfilename, mode='w:gz') as tar: 138 with tarfile.open(tarfilename, mode='w:gz') as tar:
139 for f in listdir(FLETCH_DIR): 139 for f in listdir(DARTINO_DIR):
140 tar.add(join(FLETCH_DIR, f), filter=Filter) 140 tar.add(join(DARTINO_DIR, f), filter=Filter)
141 for f in listdir(join(FLETCH_DIR, debian_dir)): 141 for f in listdir(join(DARTINO_DIR, debian_dir)):
142 tar.add(join(FLETCH_DIR, debian_dir, f), 142 tar.add(join(DARTINO_DIR, debian_dir, f),
143 arcname='%s/debian/%s' % (versiondir, f)) 143 arcname='%s/debian/%s' % (versiondir, f))
144 tar.add(join(FLETCH_DIR, 'platforms/raspberry-pi2/data/dartino-agent'), 144 tar.add(join(DARTINO_DIR, 'platforms/raspberry-pi2/data/dartino-agent'),
145 arcname='%s/debian/dartino-agent.init' % versiondir) 145 arcname='%s/debian/dartino-agent.init' % versiondir)
146 tar.add(join(FLETCH_DIR, 'platforms/raspberry-pi2/data/dartino-agent.env'), 146 tar.add(join(DARTINO_DIR, 'platforms/raspberry-pi2/data/dartino-agent.env'),
147 arcname='%s/debian/dartino-agent.default' % versiondir) 147 arcname='%s/debian/dartino-agent.default' % versiondir)
148 148
149 with utils.TempDir() as temp_dir: 149 with utils.TempDir() as temp_dir:
150 # Generate and add debian/copyright 150 # Generate and add debian/copyright
151 copyright_file = join(temp_dir, 'copyright') 151 copyright_file = join(temp_dir, 'copyright')
152 GenerateCopyright(copyright_file) 152 GenerateCopyright(copyright_file)
153 tar.add(copyright_file, arcname='%s/debian/copyright' % versiondir) 153 tar.add(copyright_file, arcname='%s/debian/copyright' % versiondir)
154 154
155 # Generate and add debian/changelog 155 # Generate and add debian/changelog
156 change_log = join(temp_dir, 'changelog') 156 change_log = join(temp_dir, 'changelog')
(...skipping 13 matching lines...) Expand all
170 170
171 # Parse the options. 171 # Parse the options.
172 parser = BuildOptions() 172 parser = BuildOptions()
173 (options, args) = parser.parse_args() 173 (options, args) = parser.parse_args()
174 if options.verbose: 174 if options.verbose:
175 global verbose 175 global verbose
176 verbose = True 176 verbose = True
177 177
178 tar_filename = options.tar_filename 178 tar_filename = options.tar_filename
179 if not tar_filename: 179 if not tar_filename:
180 tar_filename = join(FLETCH_DIR, 180 tar_filename = join(DARTINO_DIR,
181 utils.GetBuildDir(HOST_OS), 181 utils.GetBuildDir(HOST_OS),
182 'dartino-%s.tar.gz' % utils.GetVersion()) 182 'dartino-%s.tar.gz' % utils.GetVersion())
183 183
184 CreateTarball(tar_filename) 184 CreateTarball(tar_filename)
185 185
186 if __name__ == '__main__': 186 if __name__ == '__main__':
187 sys.exit(Main()) 187 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/create_debian_packages.py ('k') | tools/cxx_wrapper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698