예제 #1
0
    def __write_setup_file(self, file):
        setup_info = dict(self.__setup_info)

        setup_args = []

        packages = setup_info.pop('packages', None)
        if packages is None:
            # no 'packages' option was given, or it is None
            setup_args.append('packages=find_packages()')
        else:
            setup_args.append('packages={0!r}'.format(packages))

        for key, value in setup_info.iteritems():
            val = self.options.get(key, value)
            setup_args.append('{0}={1!r}'.format(key, val))

        setup = LazyFileWriter(file)
        setup.create()
        setup.write('''#!{0}
#########################################################################
#                                                                       #
#               -----------------------------------------               #
#                THIS FILE WAS AUTOGENERATED BY MIRBUILD                #
#               -----------------------------------------               #
#                                                                       #
#  You can put your own customisations in this file, just remove this   #
#  header and the file won't be cleaned up automatically.               #
#                                                                       #
#########################################################################

from setuptools import setup, find_packages

setup({1})
'''.format(sys.executable, ",\n      ".join(setup_args)))
        setup.commit()
예제 #2
0
    def __write_setup_file(self, file):
        setup_info = dict(self.__setup_info)

        setup_args = []

        packages = setup_info.pop('packages', None)
        if packages is None:
            # no 'packages' option was given, or it is None
            setup_args.append('packages=find_packages()')
        else:
            setup_args.append('packages={0!r}'.format(packages))

        for key, value in setup_info.iteritems():
            val = self.options.get(key, value)
            setup_args.append('{0}={1!r}'.format(key, val))

        setup = LazyFileWriter(file)
        setup.create()
        setup.write('''#!{0}
#########################################################################
#                                                                       #
#               -----------------------------------------               #
#                THIS FILE WAS AUTOGENERATED BY MIRBUILD                #
#               -----------------------------------------               #
#                                                                       #
#  You can put your own customisations in this file, just remove this   #
#  header and the file won't be cleaned up automatically.               #
#                                                                       #
#########################################################################

from setuptools import setup, find_packages

setup({1})
'''.format(sys.executable, ",\n      ".join(setup_args)))
        setup.commit()
예제 #3
0
    def do_configure(self):
        slc = {
            'CPPPATH': list(os.path.realpath(i) for i in self.__incpath),
            'LIBPATH': list(os.path.realpath(i) for i in self.__libpath),
            'CPPDEFINES': self.__defines,
            'CCFLAGS': ['-Wall'],
            'LINKFLAGS': {},
            'PREFIX': self.opt.prefix,
        }
        if self.env.has_tool('cxx'):
            slc['CXX'] = self.env.tool('cxx')
        if self.env.has_tool('cc'):
            slc['CC'] = self.env.tool('cc')

        getattr(self, 'configure_' + self.build_config)(slc)

        slcfile = LazyFileWriter('scons-local-config.py')
        slcfile.create()
        slcfile.write(
            '# build configuration for {0} (generated by {1})\n'.format(
                self.project_name, self.ident))
        slcfile.write("".join(
            ("{0} = {1!r}\n".format(i, slc[i])) for i in sorted(slc)))
        slcfile.commit()
예제 #4
0
    def do_configure(self):
        slc = {
            'CPPPATH': list(os.path.realpath(i) for i in self.__incpath),
            'LIBPATH': list(os.path.realpath(i) for i in self.__libpath),
            'CPPDEFINES': self.__defines,
            'CCFLAGS': ['-Wall'],
            'LINKFLAGS': {},
            'PREFIX' :self.opt.prefix,
            }
        if self.env.has_tool('cxx'):
            slc['CXX'] = self.env.tool('cxx')
        if self.env.has_tool('cc'):
            slc['CC'] = self.env.tool('cc')

        getattr(self, 'configure_' + self.build_config)(slc)

        slcfile = LazyFileWriter('scons-local-config.py')
        slcfile.create()
        slcfile.write('# build configuration for {0} (generated by {1})\n'.format(self.project_name, self.ident))
        slcfile.write("".join(("{0} = {1!r}\n".format(i, slc[i])) for i in sorted(slc)))
        slcfile.commit()
예제 #5
0
 def generate(self, info):
     self.__defaults(self.filename, self._env.project_name)
     description = self._env.project_name if info.description(
     ) is None else info.description()
     copyright = Copyright()
     fh = [LazyFileWriter(self.filename), [StringIO(), StringIO()]]
     fh[0].create()
     fh[0].write('#ifndef ' + self.__guard + '\n')
     fh[0].write('#define ' + self.__guard + '\n\n')
     self.__writestr(fh, 'NAME', self._env.project_name, False)
     self.__writestr(
         fh, 'VERSION', '{0}.{1}.{2}'.format(info.major_rev(),
                                             info.minor_rev(),
                                             info.patchlevel()), False)
     self.__writestr(fh, 'DESCRIPTION', description, False)
     self.__writestr(fh, 'COPYRIGHT', copyright.short, False)
     self.__writestr(fh, 'COPYRIGHT_FULL', copyright.full, False)
     fh[0].write('\n')
     self.__writestr(fh, 'PROJECT', self._env.project_name)
     self.__writestr(fh, 'PACKAGE', info.package())
     self.__writestr(fh, 'AUTHOR', info.author())
     self.__writestr(fh, 'RELEASE_ISODATE', info.date().isoformat())
     self.__writestr(fh, 'RELEASE_YEAR', info.date().strftime('%Y'))
     self.__writestr(fh, 'RELEASE_DATE', info.date().strftime('%Y-%m-%d'))
     self.__writestr(fh, 'RELEASE_TIME', info.date().strftime('%H:%M:%S'))
     self.__writestr(fh, 'FULL_REVISION', info.full_version())
     self.__writestr(fh, 'REVISION', info.upstream_version())
     fh[0].write('\n')
     self.__write(fh, 'RELEASE_YEAR', info.date().strftime('%Y'))
     self.__write(fh, 'RELEASE_EPOCH_TIME', int(info.time()), 'time_t')
     self.__write(fh, 'MAJOR_REVISION', info.major_rev())
     self.__write(fh, 'MINOR_REVISION', info.minor_rev())
     self.__write(fh, 'PATCHLEVEL', info.patchlevel())
     fh[0].write(self.__vinfo(fh[1]))
     fh[0].write('\n#endif /* ' + self.__guard + ' */\n')
     fh[0].commit()
예제 #6
0
 def __init__(self, name):
     LazyFileWriter.__init__(self, name)
     self.__scopestack = []
예제 #7
0
    def __write_file(self):
        pkgs = DebianControl().packages
        tmpdir = pkgs[0] if len(pkgs) == 1 and not os.path.exists(
            os.path.join('debian', pkgs[0] + '.install')) else 'tmp'

        fh = LazyFileWriter(self.rules_file, executable=True)
        fh.create()
        fh.write('''#!/usr/bin/make -f
#########################################################################
#                                                                       #
#               -----------------------------------------               #
#                THIS FILE WAS AUTOGENERATED BY MIRBUILD                #
#               -----------------------------------------               #
#                                                                       #
#  If you really have to customise the rules file, please remove this   #
#  header and I'll never bother you again. Please try to keep in mind   #
#  that this means you can't take advantage of any future improvements  #
#  an autogenerated rules file might bring. You have been warned! ;-)   #
#                                                                       #
#########################################################################

PYTHON={0}{1}
TMP=$(CURDIR)/debian/{2}/
'''.format(self.python_executable, ' -d' if self.debug else '', tmpdir))
        if self.verbose or self.debug:
            fh.write('\nexport DH_VERBOSE=1\n')
        fh.write('''
%:
\tdh $@{0}

'''.format(''.join((' ' + i) for i in self.dh_options)))
        for target in sorted(self.__targets):
            fh.write('\n{0}:\n'.format(target))
            for line in self.__targets[target]:
                fh.write('\t{0}\n'.format(line.format(**self.__dict__)))
            fh.write('\n')

        fh.commit()
        self._set_created()
예제 #8
0
    def __write_file(self):
        pkgs = DebianControl().packages
        tmpdir = pkgs[0] if len(pkgs) == 1 and not os.path.exists(os.path.join('debian', pkgs[0] + '.install')) else 'tmp'

        fh = LazyFileWriter(self.rules_file, executable = True)
        fh.create()
        fh.write('''#!/usr/bin/make -f
#########################################################################
#                                                                       #
#               -----------------------------------------               #
#                THIS FILE WAS AUTOGENERATED BY MIRBUILD                #
#               -----------------------------------------               #
#                                                                       #
#  If you really have to customise the rules file, please remove this   #
#  header and I'll never bother you again. Please try to keep in mind   #
#  that this means you can't take advantage of any future improvements  #
#  an autogenerated rules file might bring. You have been warned! ;-)   #
#                                                                       #
#########################################################################

PYTHON={0}{1}
TMP=$(CURDIR)/debian/{2}/
'''.format(self.python_executable, ' -d' if self.debug else '', tmpdir))
        if self.verbose or self.debug:
            fh.write('\nexport DH_VERBOSE=1\n')
        fh.write('''
%:
\tdh $@{0}

'''.format(''.join((' '+i) for i in self.dh_options)))
        for target in sorted(self.__targets):
            fh.write('\n{0}:\n'.format(target))
            for line in self.__targets[target]:
                fh.write('\t{0}\n'.format(line.format(**self.__dict__)))
            fh.write('\n')

        fh.commit()
        self._set_created()
예제 #9
0
 def __init__(self, name):
     LazyFileWriter.__init__(self, name)
     self.__scopestack = []