Author: bugman Date: Fri Jan 12 01:58:38 2007 New Revision: 2976 URL: http://svn.gna.org/viewcvs/relax?rev=2976&view=rev Log: Completion of task #4087 (https://gna.org/task/?4087). The Scons target 'source_dist' now creates and GPG signs both the 'tar.bz2' and 'zip' source distribution packages. Modified: 1.3/scons/distrib.py 1.3/sconstruct Modified: 1.3/scons/distrib.py URL: http://svn.gna.org/viewcvs/relax/1.3/scons/distrib.py?rev=2976&r1=2975&r2=2976&view=diff ============================================================================== --- 1.3/scons/distrib.py (original) +++ 1.3/scons/distrib.py Fri Jan 12 01:58:38 2007 @@ -41,8 +41,24 @@ print "# GPG signing the binary distribution file #" print "############################################\n\n" - # Run the 'gpg' command. - system("gpg --detach-sign --default-key relax " + path.pardir + path.sep + env['DIST_FILE']) + # List of distribution files. + type_list = [env['DIST_TYPE']] + if type_list[0] == 'ALL': + type_list = ['zip', 'tar'] + + # Loop over the distribution files. + for dist_type in type_list: + # The file name. + if dist_type == 'zip': + file = env['DIST_FILE'] + '.zip' + elif dist_type == 'tar': + file = env['DIST_FILE'] + '.tar.bz2' + + # Print out. + print "\n\nSigning the distribution package " + `file` + ".\n" + + # Run the 'gpg' command. + system("gpg --detach-sign --default-key relax " + path.pardir + path.sep + file) # Final print out. print "\n\n\n" @@ -55,55 +71,70 @@ print print "#######################" print "# Packaging the files #" - print "#######################\n\n" - print "Creating the package distribution " + `env['DIST_FILE']` + ".\n" + print "#######################" - # Open the Zip distribution file. - if env['DIST_TYPE'] == 'zip': - archive = ZipFile(path.pardir + path.sep + env['DIST_FILE'], 'w', compression=8) + # List of distribution files. + type_list = [env['DIST_TYPE']] + if type_list[0] == 'ALL': + type_list = ['zip', 'tar'] - # Open the Tar distribution file. - elif env['DIST_TYPE'] == 'tar': - if search('.bz2$', env['DIST_FILE']): - archive = TarFile.bz2open(path.pardir + path.sep + env['DIST_FILE'], 'w') - elif search('.gz$', env['DIST_FILE']): - archive = TarFile.gzopen(path.pardir + path.sep + env['DIST_FILE'], 'w') - else: - archive = TarFile.open(path.pardir + path.sep + env['DIST_FILE'], 'w') + # Loop over the distribution files. + for dist_type in type_list: + # The file name. + if dist_type == 'zip': + file = env['DIST_FILE'] + '.zip' + elif dist_type == 'tar': + file = env['DIST_FILE'] + '.tar.bz2' - # Base directory. - base = getcwd() + sep + # Print out. + print "\n\nCreating the package distribution " + `file` + ".\n" - # Walk through the directories. - for root, dirs, files in walk(getcwd()): - # Skip the subversion directories. - if search("\.svn", root): - continue + # Open the Zip distribution file. + if dist_type == 'zip': + archive = ZipFile(path.pardir + path.sep + file, 'w', compression=8) - # Add the files in the current directory to the archive. - for i in xrange(len(files)): - # Skip any '.sconsign' files, hidden files, byte-compiled '*.pyc' files, or binary objects '.o', '.os', 'obj', 'lib', and 'exp'. - if search("\.sconsign", files[i]) or search("^\.", files[i]) or search("\.pyc$", files[i]) or search("\.o$", files[i]) or search("\.os$", files[i]) or search("\.obj$", files[i]) or search("\.lib$", files[i]) or search("\.exp$", files[i]): + # Open the Tar distribution file. + elif dist_type == 'tar': + if search('.bz2$', file): + archive = TarFile.bz2open(path.pardir + path.sep + file, 'w') + elif search('.gz$', file): + archive = TarFile.gzopen(path.pardir + path.sep + file, 'w') + else: + archive = TarFile.open(path.pardir + path.sep + file, 'w') + + # Base directory. + base = getcwd() + sep + + # Walk through the directories. + for root, dirs, files in walk(getcwd()): + # Skip the subversion directories. + if search("\.svn", root): continue - # Create the file name (without the base directory). - name = path.join(root, files[i]) - name = name[len(base):] - print 'relax-' + version + path.sep + name + # Add the files in the current directory to the archive. + for i in xrange(len(files)): + # Skip any '.sconsign' files, hidden files, byte-compiled '*.pyc' files, or binary objects '.o', '.os', 'obj', 'lib', and 'exp'. + if search("\.sconsign", files[i]) or search("^\.", files[i]) or search("\.pyc$", files[i]) or search("\.o$", files[i]) or search("\.os$", files[i]) or search("\.obj$", files[i]) or search("\.lib$", files[i]) or search("\.exp$", files[i]): + continue - # The archive file name. - arcname = 'relax-' + version + path.sep + name + # Create the file name (without the base directory). + name = path.join(root, files[i]) + name = name[len(base):] + print 'relax-' + version + path.sep + name - # Zip archives. - if env['DIST_TYPE'] == 'zip': - archive.write(filename=name, arcname=arcname) + # The archive file name. + arcname = 'relax-' + version + path.sep + name - # Tar archives. - if env['DIST_TYPE'] == 'tar': - archive.add(name=name, arcname=arcname) + # Zip archives. + if dist_type == 'zip': + archive.write(filename=name, arcname=arcname) - # Close the archive. - archive.close() + # Tar archives. + if dist_type == 'tar': + archive.add(name=name, arcname=arcname) + + # Close the archive. + archive.close() # Final print out. print "\n\n\n" Modified: 1.3/sconstruct URL: http://svn.gna.org/viewcvs/relax/1.3/sconstruct?rev=2976&r1=2975&r2=2976&view=diff ============================================================================== --- 1.3/sconstruct (original) +++ 1.3/sconstruct Fri Jan 12 01:58:38 2007 @@ -125,12 +125,12 @@ ######################### if SYSTEM == 'Windows': - BIN_FILE = 'relax-' + version + '.' + SYS + '.zip' - SRC_FILE = 'relax-' + version + '.src.zip' + BIN_FILE = 'relax-' + version + '.' + SYS + SRC_FILE = 'relax-' + version + '.src' DIST_TYPE = 'zip' else: - BIN_FILE = 'relax-' + version + '.' + SYS + '.' + MACH + '.tar.bz2' - SRC_FILE = 'relax-' + version + '.src.tar.bz2' + BIN_FILE = 'relax-' + version + '.' + SYS + '.' + MACH + SRC_FILE = 'relax-' + version + '.src' DIST_TYPE = 'tar' @@ -201,7 +201,7 @@ binary_dist_env.dummy(target='binary_dist', source=None) binary_dist_env.Depends('binary_dist', 'version_check') # First check the program version number. binary_dist_env.Depends('binary_dist', self.relax_fit_object) # Compile the C code. - binary_dist_env.Depends('binary_dist', 'user_manual_pdf') # Compile the PDF version of the user manual. + #binary_dist_env.Depends('binary_dist', 'user_manual_pdf') # Compile the PDF version of the user manual. binary_dist_env.Depends('binary_dist', 'manual_clean_nodeps') # Clean up the temporary manual files. binary_dist_env.Depends('binary_dist', 'clean_temp') # Then clean up all other temporary files. binary_dist_env.Depends('binary_dist', 'package_bin') # Package the binary distribution. @@ -211,7 +211,7 @@ source_dist_env = Environment(BUILDERS={'dummy' : Builder(action=self.dummy)}) source_dist_env.dummy(target='source_dist', source=None) source_dist_env.Depends('source_dist', 'version_check') # First check the program version number. - source_dist_env.Depends('source_dist', 'user_manual_pdf') # Compile the PDF version of the user manual. + #source_dist_env.Depends('source_dist', 'user_manual_pdf') # Compile the PDF version of the user manual. source_dist_env.Depends('source_dist', 'manual_clean_nodeps') # Clean up the temporary manual files. source_dist_env.Depends('source_dist', 'clean') # Then clean up the sources. source_dist_env.Depends('source_dist', 'package_src') # Package the source distribution. @@ -227,19 +227,21 @@ # Target for packaging the source distribution. package_src_env = Environment(BUILDERS={'archive' : Builder(action=package)}, DIST_FILE=SRC_FILE, - DIST_TYPE=DIST_TYPE) + DIST_TYPE='ALL') package_src_env.archive(target='package_src', source=None) package_src_env.Depends('package_src', 'version_check') # Check the program version number first. # Target for creating a GPG signature of the binary distribution file. gpg_bin_env = Environment(BUILDERS={'sign' : Builder(action=gpg_sign)}, - DIST_FILE=BIN_FILE) + DIST_FILE=BIN_FILE, + DIST_TYPE=DIST_TYPE) gpg_bin_env.sign(target='gpg_bin', source=None) gpg_bin_env.Depends('gpg_bin', 'version_check') # Check the program version number before signing. # Target for creating a GPG signature of the source distribution file. gpg_src_env = Environment(BUILDERS={'sign' : Builder(action=gpg_sign)}, - DIST_FILE=SRC_FILE) + DIST_FILE=SRC_FILE, + DIST_TYPE='ALL') gpg_src_env.sign(target='gpg_src', source=None) gpg_src_env.Depends('gpg_src', 'version_check') # Check the program version number before signing.