def test_compress_deprecated(self): tmpdir, tmpdir2, base_name = self._create_files() # using compress and testing the PendingDeprecationWarning old_dir = os.getcwd() os.chdir(tmpdir) try: with check_warnings() as w: warnings.simplefilter("always") make_tarball(base_name, 'dist', compress='compress') finally: os.chdir(old_dir) tarball = base_name + '.tar.Z' self.assertTrue(os.path.exists(tarball)) self.assertEqual(len(w.warnings), 1) # same test with dry_run os.remove(tarball) old_dir = os.getcwd() os.chdir(tmpdir) try: with check_warnings() as w: warnings.simplefilter("always") make_tarball(base_name, 'dist', compress='compress', dry_run=True) finally: os.chdir(old_dir) self.assertTrue(not os.path.exists(tarball)) self.assertEqual(len(w.warnings), 1)
def _make_tarball(self, target_name): tmpdir = self.mkdtemp() self.write_file([tmpdir, 'file1'], 'xxx') self.write_file([tmpdir, 'file2'], 'xxx') os.mkdir(os.path.join(tmpdir, 'sub')) self.write_file([tmpdir, 'sub', 'file3'], 'xxx') tmpdir2 = self.mkdtemp() unittest.skipUnless( splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], 'source and target should be on same drive') base_name = os.path.join(tmpdir2, target_name) old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.') finally: os.chdir(old_dir) tarball = base_name + '.tar.gz' self.assertTrue(os.path.exists(tarball)) base_name = os.path.join(tmpdir2, target_name) old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.', compress=None) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball)) return
def test_compress_deprecated(self): tmpdir, tmpdir2, base_name = self._create_files() old_dir = os.getcwd() os.chdir(tmpdir) try: with check_warnings() as w: warnings.simplefilter('always') make_tarball(base_name, 'dist', compress='compress') finally: os.chdir(old_dir) tarball = base_name + '.tar.Z' self.assertTrue(os.path.exists(tarball)) self.assertEqual(len(w.warnings), 1) os.remove(tarball) old_dir = os.getcwd() os.chdir(tmpdir) try: with check_warnings() as w: warnings.simplefilter('always') make_tarball(base_name, 'dist', compress='compress', dry_run=True) finally: os.chdir(old_dir) self.assertFalse(os.path.exists(tarball)) self.assertEqual(len(w.warnings), 1)
def test_compress_deprecated(self): tmpdir = self._create_files() base_name = os.path.join(self.mkdtemp(), 'archive') # using compress and testing the PendingDeprecationWarning old_dir = os.getcwd() os.chdir(tmpdir) try: with check_warnings() as w: warnings.simplefilter("always") make_tarball(base_name, 'dist', compress='compress') finally: os.chdir(old_dir) tarball = base_name + '.tar.Z' self.assertTrue(os.path.exists(tarball)) self.assertEqual(len(w.warnings), 1) # same test with dry_run os.remove(tarball) old_dir = os.getcwd() os.chdir(tmpdir) try: with check_warnings() as w: warnings.simplefilter("always") make_tarball(base_name, 'dist', compress='compress', dry_run=True) finally: os.chdir(old_dir) self.assertFalse(os.path.exists(tarball)) self.assertEqual(len(w.warnings), 1)
def _make_tarball(self, target_name): tmpdir = self.mkdtemp() self.write_file([tmpdir, 'file1'], 'xxx') self.write_file([tmpdir, 'file2'], 'xxx') os.mkdir(os.path.join(tmpdir, 'sub')) self.write_file([tmpdir, 'sub', 'file3'], 'xxx') tmpdir2 = self.mkdtemp() unittest.skipUnless(splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], 'source and target should be on same drive') base_name = os.path.join(tmpdir2, target_name) old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.') finally: os.chdir(old_dir) tarball = base_name + '.tar.gz' self.assertTrue(os.path.exists(tarball)) base_name = os.path.join(tmpdir2, target_name) old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.', compress=None) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball)) return
def _make_tarball(self, tmpdir, target_name, suffix, **kwargs): tmpdir2 = self.mkdtemp() unittest.skipUnless( splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], 'source and target should be on same drive') base_name = os.path.join(tmpdir2, target_name) with change_cwd(tmpdir): make_tarball(splitdrive(base_name)[1], 'dist', **kwargs) tarball = base_name + suffix self.assertTrue(os.path.exists(tarball)) self.assertEqual(self._tarinfo(tarball), self._created_files)
def _make_tarball(self, tmpdir, target_name, suffix, **kwargs): tmpdir2 = self.mkdtemp() unittest.skipUnless(splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], "source and target should be on same drive") base_name = os.path.join(tmpdir2, target_name) # working with relative paths to avoid tar warnings with change_cwd(tmpdir): make_tarball(splitdrive(base_name)[1], 'dist', **kwargs) # check if the compressed tarball was created tarball = base_name + suffix self.assertTrue(os.path.exists(tarball)) self.assertEqual(self._tarinfo(tarball), self._created_files)
def test_tarfile_root_owner(self): tmpdir, tmpdir2, base_name = self._create_files() old_dir = os.getcwd() os.chdir(tmpdir) group = grp.getgrgid(0)[0] owner = pwd.getpwuid(0)[0] try: archive_name = make_tarball(base_name, 'dist', compress=None, owner=owner, group=group) finally: os.chdir(old_dir) self.assertTrue(os.path.exists(archive_name)) archive = tarfile.open(archive_name) try: for member in archive.getmembers(): self.assertEqual(member.uid, 0) self.assertEqual(member.gid, 0) finally: archive.close() return
def test_tarfile_root_owner(self): tmpdir = self._create_files() base_name = os.path.join(self.mkdtemp(), 'archive') old_dir = os.getcwd() os.chdir(tmpdir) group = grp.getgrgid(0)[0] owner = pwd.getpwuid(0)[0] try: archive_name = make_tarball(base_name, 'dist', compress=None, owner=owner, group=group) finally: os.chdir(old_dir) # check if the compressed tarball was created self.assertTrue(os.path.exists(archive_name)) # now checks the rights archive = tarfile.open(archive_name) try: for member in archive.getmembers(): self.assertEqual(member.uid, 0) self.assertEqual(member.gid, 0) finally: archive.close()
def test_make_tarball(self): # creating something to tar tmpdir = self.mkdtemp() self.write_file([tmpdir, 'file1'], 'xxx') self.write_file([tmpdir, 'file2'], 'xxx') os.mkdir(os.path.join(tmpdir, 'sub')) self.write_file([tmpdir, 'sub', 'file3'], 'xxx') tmpdir2 = self.mkdtemp() unittest.skipUnless( splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], "source and target should be on same drive") base_name = os.path.join(tmpdir2, 'archive') # working with relative paths to avoid tar warnings old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.') finally: os.chdir(old_dir) # check if the compressed tarball was created tarball = base_name + '.tar.gz' self.assertTrue(os.path.exists(tarball)) # trying an uncompressed one base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.', compress=None) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball))
def _make_tarball(self, target_name): # creating something to tar tmpdir = self.mkdtemp() self.write_file([tmpdir, "file1"], "xxx") self.write_file([tmpdir, "file2"], "xxx") os.mkdir(os.path.join(tmpdir, "sub")) self.write_file([tmpdir, "sub", "file3"], "xxx") tmpdir2 = self.mkdtemp() unittest.skipUnless( splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], "Source and target should be on same drive" ) base_name = os.path.join(tmpdir2, target_name) # working with relative paths to avoid tar warnings old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], ".") finally: os.chdir(old_dir) # check if the compressed tarball was created tarball = base_name + ".tar.gz" self.assertTrue(os.path.exists(tarball)) # trying an uncompressed one base_name = os.path.join(tmpdir2, target_name) old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], ".", compress=None) finally: os.chdir(old_dir) tarball = base_name + ".tar" self.assertTrue(os.path.exists(tarball))
def test_make_tarball(self): # creating something to tar tmpdir = self.mkdtemp() self.write_file([tmpdir, 'file1'], 'xxx') self.write_file([tmpdir, 'file2'], 'xxx') os.mkdir(os.path.join(tmpdir, 'sub')) self.write_file([tmpdir, 'sub', 'file3'], 'xxx') tmpdir2 = self.mkdtemp() unittest.skipUnless(splitdrive(tmpdir)[0] == splitdrive(tmpdir2)[0], "Source and target should be on same drive") base_name = os.path.join(tmpdir2, 'archive') # working with relative paths to avoid tar warnings old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.') finally: os.chdir(old_dir) # check if the compressed tarball was created tarball = base_name + '.tar.gz' self.assertTrue(os.path.exists(tarball)) # trying an uncompressed one base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(splitdrive(base_name)[1], '.', compress=None) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball))
def test_tarfile_vs_tar(self): tmpdir = self._create_files() tmpdir2 = self.mkdtemp() base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist') finally: os.chdir(old_dir) # check if the compressed tarball was created tarball = base_name + '.tar.gz' self.assertTrue(os.path.exists(tarball)) # now create another tarball using `tar` tarball2 = os.path.join(tmpdir, 'archive2.tar.gz') tar_cmd = ['tar', '-cf', 'archive2.tar', 'dist'] gzip_cmd = ['gzip', '-f', '-9', 'archive2.tar'] old_dir = os.getcwd() os.chdir(tmpdir) try: spawn(tar_cmd) spawn(gzip_cmd) finally: os.chdir(old_dir) self.assertTrue(os.path.exists(tarball2)) # let's compare both tarballs self.assertEqual(self._tarinfo(tarball), self._created_files) self.assertEqual(self._tarinfo(tarball2), self._created_files) # trying an uncompressed one base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist', compress=None) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball)) # now for a dry_run base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist', compress=None, dry_run=True) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball))
def test_tarfile_vs_tar(self): tmpdir = self._create_files() tmpdir2 = self.mkdtemp() base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist') finally: os.chdir(old_dir) # check if the compressed tarball was created tarball = base_name + '.tar.gz' self.assertTrue(os.path.exists(tarball)) # now create another tarball using `tar` tarball2 = os.path.join(tmpdir, 'archive2.tar.gz') tar_cmd = ['tar', '-cf', 'archive2.tar', 'dist'] gzip_cmd = ['gzip', '-f9', 'archive2.tar'] old_dir = os.getcwd() os.chdir(tmpdir) try: spawn(tar_cmd) spawn(gzip_cmd) finally: os.chdir(old_dir) self.assertTrue(os.path.exists(tarball2)) # let's compare both tarballs self.assertEqual(self._tarinfo(tarball), self._created_files) self.assertEqual(self._tarinfo(tarball2), self._created_files) # trying an uncompressed one base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist', compress=None) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball)) # now for a dry_run base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist', compress=None, dry_run=True) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball))
def test_tarfile_vs_tar(self): tmpdir, tmpdir2, base_name = self._create_files() old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, "dist") finally: os.chdir(old_dir) # check if the compressed tarball was created tarball = base_name + ".tar.gz" self.assertTrue(os.path.exists(tarball)) # now create another tarball using `tar` tarball2 = os.path.join(tmpdir, "archive2.tar.gz") tar_cmd = ["tar", "-cf", "archive2.tar", "dist"] gzip_cmd = ["gzip", "-f9", "archive2.tar"] old_dir = os.getcwd() os.chdir(tmpdir) try: spawn(tar_cmd) spawn(gzip_cmd) finally: os.chdir(old_dir) self.assertTrue(os.path.exists(tarball2)) # let's compare both tarballs self.assertEqual(self._tarinfo(tarball), self._tarinfo(tarball2)) # trying an uncompressed one base_name = os.path.join(tmpdir2, "archive") old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, "dist", compress=None) finally: os.chdir(old_dir) tarball = base_name + ".tar" self.assertTrue(os.path.exists(tarball)) # now for a dry_run base_name = os.path.join(tmpdir2, "archive") old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, "dist", compress=None, dry_run=True) finally: os.chdir(old_dir) tarball = base_name + ".tar" self.assertTrue(os.path.exists(tarball))
def test_tarfile_vs_tar(self): tmpdir, tmpdir2, base_name = self._create_files() old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist') finally: os.chdir(old_dir) tarball = base_name + '.tar.gz' self.assertTrue(os.path.exists(tarball)) tarball2 = os.path.join(tmpdir, 'archive2.tar.gz') tar_cmd = ['tar', '-cf', 'archive2.tar', 'dist'] gzip_cmd = ['gzip', '-f9', 'archive2.tar'] old_dir = os.getcwd() os.chdir(tmpdir) try: spawn(tar_cmd) spawn(gzip_cmd) finally: os.chdir(old_dir) self.assertTrue(os.path.exists(tarball2)) self.assertEqual(self._tarinfo(tarball), self._tarinfo(tarball2)) base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist', compress=None) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball)) base_name = os.path.join(tmpdir2, 'archive') old_dir = os.getcwd() os.chdir(tmpdir) try: make_tarball(base_name, 'dist', compress=None, dry_run=True) finally: os.chdir(old_dir) tarball = base_name + '.tar' self.assertTrue(os.path.exists(tarball)) return
journal_dictionary = path.join(dictionary, 'journal') mkpath(journal_dictionary) units = [ 'confluent', 'ntpd' 'influxdb', 'gmond', 'postgresql', 'slapd', 'nginx', 'nslcd', 'slurmd', 'slurmctld', 'rabbitmq-server', 'antilles', 'antilles-ganglia-mond', 'antilles-confluent-mond-power', 'antilles-confluent-mond-health', 'antilles-confluent-mond-temp', 'antilles-vnc-mond-xvnc', ] for unit in units: with open(path.join(journal_dictionary, unit), 'w') as f: call(['journalctl', '-xe', '-u', unit], stdout=f) make_tarball(base_name=path.basename(dictionary), base_dir=dictionary) finally: remove_tree(dictionary)
import os import shutil from distutils.core import setup from distutils.archive_util import make_tarball from setuptools import find_packages jars = ['jars/%s' % (f) for f in os.listdir('jars')] setup(name='geoscript', version='1.0.1', description='GeoScript Python', author='Justin Deoliveira', author_email='*****@*****.**', url='http://geoscript.org', packages=find_packages(), data_files=[('jars', jars)], scripts=['bin/geoscript-classpath', 'bin/geoscript']) shutil.move(make_tarball('geoscript-1.0.1-src', 'geoscript'), 'dist')
def _create_pkg(self, template_name, dmg=False, sign=False, root="", identity=""): """Create the Solaris package using the OS dependent commands.""" self.log.info("-> _create_pkg()") self.log.info("template_name: {}".format(template_name)) self.log.info("identity: {}".format(identity)) sun_dist_name = template_name.format(self.name, self.version) self.sun_pkg_name = "{}.pkg".format(sun_dist_name) sun_pkg_contents = os.path.join(self.sun_pkg_name, "Contents") self.log.info("sun_dist_name: {}".format(sun_dist_name)) self.log.info("sun_pkg_name: {}".format(self.sun_pkg_name)) self.log.info("sun_pkg_contents: {}".format(sun_pkg_contents)) sun_path = os.path.join(root, self.dstroot) os.chdir(sun_path) self.log.info("Root directory for Prototype: {}".format(os.getcwd())) # Creating a Prototype file, this contains a table of contents of the # Package, that is suitable to be used for the package creation tool. self.log.info("Creating Prototype file on {} to describe files to " "install".format(self.dstroot)) prototype_path = "Prototype" proto_tmp = "Prototype_temp" with open(proto_tmp, "w") as f_out: cmd = ["pkgproto", "."] pkgp_p = subprocess.Popen(cmd, shell=False, stdout=f_out, stderr=f_out) res = pkgp_p.wait() if res != 0: self.log.error("pkgproto command failed with: {}".format(res)) raise DistutilsExecError("pkgproto command failed with: {}" "".format(res)) f_out.flush() # log Prototype contents self.log.info("/n>> Prototype_temp contents >>/n") with open(proto_tmp, "r") as f_in: self.log.info(f_in.readlines()) self.log.info("/n<< Prototype_temp contents end <</n") # Fix Prototype file, insert pkginfo and remove Prototype self.log.info("Fixing folder permissions on Prototype contents") with open(prototype_path, "w") as f_out: with open(proto_tmp, "r") as f_in: # Add pkginfo entry at beginning of the Prototype file f_out.write("i pkginfo\n") f_out.flush() for line in f_in: if line.startswith("f none Prototype"): continue elif line.startswith("f none pkginfo"): continue elif line.startswith("d"): tokeep = line.split(" ")[:-3] tokeep.extend(["?", "?", "?", "\n"]) f_out.write(" ".join(tokeep)) elif line.startswith("f"): tokeep = line.split(" ")[:-2] tokeep.extend(["root", "bin", "\n"]) f_out.write(" ".join(tokeep)) else: f_out.write(line) f_out.flush() # log Prototype contents self.log.info("/n>> Prototype contents >>/n") with open(prototype_path, "r") as f_in: self.log.info(f_in.readlines()) self.log.info("/n<< Prototype contents end <</n") # Create Solaris package running the package creation command pkgmk self.log.info("Creating package with pkgmk") self.log.info("Root directory for pkgmk: {}".format(os.getcwd())) self.spawn( ["pkgmk", "-o", "-r", ".", "-d", "../", "-f", prototype_path]) os.chdir("../") if self.debug: self.log.info("current directory: {}".format(os.getcwd())) # gzip the package folder self.log.info("creating tarball") make_tarball(self.sun_pkg_name, self.name, compress="gzip") if self.trans: self.log.info("Transforming package into data stream with " "pkgtrans") self.log.info("Current directory: {}".format(os.getcwd())) self.spawn([ "pkgtrans", "-s", os.getcwd(), os.path.join(os.getcwd(), self.sun_pkg_name), self.name ]) for base, _, files in os.walk(os.getcwd()): for filename in files: if filename.endswith(".gz") or filename.endswith(".pkg"): new_name = filename.replace( "{}".format(self.version), "{}{}{}{}-{}".format(self.version, self.version_extra, self.platform, self.platform_version, self.architecture)) file_path = os.path.join(base, filename) file_dest = os.path.join(self.started_dir, self.dist_dir, new_name) copy_file(file_path, file_dest) break
def _create_pkg(self, template_name, dmg=False, sign=False, root='', identity=''): """reate the Solaris package using the OS dependient commands. """ log.info("-> _create_pkg()") log.info("template_name: {0}".format(template_name)) log.info("identity: {0}".format(identity)) sun_dist_name = template_name.format(self.name, self.version) self.sun_pkg_name = "{0}.pkg".format(sun_dist_name) sun_pkg_contents = os.path.join(self.sun_pkg_name, 'Contents') log.info("sun_dist_name: {0}".format(sun_dist_name)) log.info("sun_pkg_name: {0}".format(self.sun_pkg_name)) log.info("sun_pkg_contents: {0}".format(sun_pkg_contents)) sun_path = os.path.join(root, self.dstroot) os.chdir(sun_path) log.info("Root directory for Prototype: {0}".format(os.getcwd())) # creating a Prototype file, this containts a table of contents of the # Package, that is suitable to be used for the package creation tool. log.info("Creating Prototype file on {0} to describe files to install" "".format(self.dstroot)) prototype_path = 'Prototype' proto_tmp = 'Prototype_temp' with open(proto_tmp, "w") as f_out: cmd = ['pkgproto', '.'] pkgp_p = subprocess.Popen(cmd, shell=False, stdout=f_out, stderr=f_out) res = pkgp_p.wait() if res != 0: log.error("pkgproto command failed with: {0}".format(res)) raise DistutilsExecError("pkgproto command failed with: {0}" "".format(res)) f_out.flush() # log Prototype contents log.info("/n>> Prototype_temp contents >>/n") with open(proto_tmp, 'r') as f_in: log.info(f_in.readlines()) log.info("/n<< Prototype_temp contents end <</n") # Fix Prototype file, incert pkginfo and remove Prototype log.info("Fixing folder permissions on Prototype contents") with open(prototype_path, 'w') as f_out: with open(proto_tmp, 'r') as f_in: # add pkginfo entry at begining of the Prototype file f_out.write("i pkginfo\n") f_out.flush() for line in f_in: if line.startswith("f none Prototype"): continue elif line.startswith("f none pkginfo"): continue elif line.startswith("d"): tokeep = line.split(' ')[:-3] tokeep.extend(['?', '?', '?', '\n']) f_out.write(' '.join(tokeep)) elif line.startswith("f"): tokeep = line.split(' ')[:-2] tokeep.extend(['root', 'bin', '\n']) f_out.write(' '.join(tokeep)) else: f_out.write(line) f_out.flush() # log Prototype contents log.info("/n>> Prototype contents >>/n") with open(prototype_path, 'r') as f_in: log.info(f_in.readlines()) log.info("/n<< Prototype contents end <</n") # Create Solaris package running the package creation command pkgmk log.info("Creating package with pkgmk") log.info("Root directory for pkgmk: {0}".format(os.getcwd())) self.spawn( ['pkgmk', '-o', '-r', '.', '-d', '../', '-f', prototype_path]) os.chdir('../') if self.debug: log.info("current directory: {0}".format(os.getcwd())) # gzip the package folder log.info("creating tarball") make_tarball(self.sun_pkg_name, self.name, compress='gzip') if self.trans: log.info("Transforming package into data stream with pkgtrans") log.info("Current directory: {0}".format(os.getcwd())) self.spawn([ 'pkgtrans', '-s', os.getcwd(), os.path.join(os.getcwd(), self.sun_pkg_name), self.name ]) for base, _, files in os.walk(os.getcwd()): for filename in files: if filename.endswith('.gz') or filename.endswith('.pkg'): new_name = filename.replace( '{0}'.format(self.version), '{0}{1}{2}{3}-{4}'.format( self.version, self.version_extra, self.platform, self.platform_version, self.architecture)) file_path = os.path.join(base, filename) file_dest = os.path.join(self.started_dir, self.dist_dir, new_name) copy_file(file_path, file_dest) break
import os import shutil from distutils.core import setup from distutils.archive_util import make_tarball from setuptools import find_packages jars = ['jars/%s' % (f) for f in os.listdir('jars')] setup(name='geoscript', version='1.0.1', description='GeoScript Python', author='Justin Deoliveira', author_email='*****@*****.**', url='http://geoscript.org', packages=find_packages(), data_files=[('jars', jars)], scripts=['bin/geoscript-classpath', 'bin/geoscript'] ) shutil.move(make_tarball('geoscript-1.0.1-src', 'geoscript'), 'dist')