Exemplo n.º 1
0
 def copy_file(self,
               infile,
               outfile,
               preserve_mode=1,
               preserve_times=1,
               link=None,
               level=1):
     if infile == 'src/lsd/version.py':
         write_version_file(outfile)
     else:
         _sdist.copy_file(self, infile, outfile, preserve_mode,
                          preserve_times, link, level)
Exemplo n.º 2
0
    def copy_file(self, f, install_dir, **kwargs):
        """Specialized version of copy_file that checks for stray passwords."""

        # If this is the configuration file, then check it for passwords
        if f == 'weewx.conf':
            import configobj
            config = configobj.ConfigObj(f)

            try:
                password = config['StdReport']['FTP']['password']
                sys.exit("\n*** FTP password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

            try:
                password = config['StdRESTful']['Wunderground']['password']
                sys.exit("\n*** Wunderground password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

            try:
                password = config['StdRESTful']['Wunderground']['password']
                sys.exit("\n*** PWSweather password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

        # Pass on to my superclass:
        return sdist.copy_file(self, f, install_dir, **kwargs)
Exemplo n.º 3
0
    def copy_file(self, f, install_dir, **kwargs):
        """Specialized version of copy_file that checks for stray passwords."""

        # If this is the configuration file, then check it for passwords
        if f == "weewx.conf":
            import configobj

            config = configobj.ConfigObj(f)

            try:
                password = config["StdReport"]["FTP"]["password"]
                sys.exit("\n*** FTP password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

            try:
                password = config["StdRESTful"]["Wunderground"]["password"]
                if password != "replace_me":
                    sys.exit("\n*** Wunderground password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

            try:
                password = config["StdRESTful"]["PWSweather"]["password"]
                if password != "replace_me":
                    sys.exit("\n*** PWSweather password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

        # Pass on to my superclass:
        return sdist.copy_file(self, f, install_dir, **kwargs)
Exemplo n.º 4
0
    def copy_file(self, f, install_dir, **kwargs):
        """Specialized version of copy_file.

        Return a tuple (dest_name, copied): 'dest_name' is the actual name of
        the output file, and 'copied' is true if the file was copied (or would
        have been copied, if 'dry_run' true)."""
        # If this is the configuration file, then massage it to eliminate
        # the password info
        if f == 'weewx.conf':
            config = configobj.ConfigObj(f)

            # If we're working with the configuration file, make sure it
            # does not have any private data in it.

            if (config.has_key('StdReport') and
                config['StdReport'].has_key('FTP') and
                config['StdReport']['FTP'].has_key('password')):
                sys.stderr.write("\n*** FTP password found in configuration file. Aborting ***\n\n")
                exit()

            rest_dict = config['StdRESTful']
            if (rest_dict.has_key('Wunderground') and
                rest_dict['Wunderground'].has_key('password')):
                sys.stderr.write("\n*** Wunderground password found in configuration file. Aborting ***\n\n")
                exit()
            if (rest_dict.has_key('PWSweather') and
                rest_dict['PWSweather'].has_key('password')):
                sys.stderr.write("\n*** PWSweather password found in configuration file. Aborting ***\n\n")
                exit()
                
        # Pass on to my superclass:
        return sdist.copy_file(self, f, install_dir, **kwargs)
Exemplo n.º 5
0
    def copy_file(self, f, install_dir, **kwargs):
        """Specialized version of copy_file that checks for stray passwords."""

        # If this is the configuration file, then check it for passwords
        if f == 'weewx.conf':
            import configobj
            config = configobj.ConfigObj(f)

            try:
                password = config['StdReport']['FTP']['password']
                sys.exit("\n*** FTP password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

            try:
                password = config['StdRESTful']['Wunderground']['password']
                if password != 'replace_me':
                    sys.exit("\n*** Wunderground password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

            try:
                password = config['StdRESTful']['PWSweather']['password']
                if password != 'replace_me':
                    sys.exit("\n*** PWSweather password found in configuration file. Aborting ***\n\n")
            except KeyError:
                pass

        # Pass on to my superclass:
        return sdist.copy_file(self, f, install_dir, **kwargs)
Exemplo n.º 6
0
    def copy_file(self, infile, outfile, **kwargs):
        """
python.org: Copy a file respecting verbose, dry-run and force flags.

:return: (tuple) Tuple (dest_name, copied)
:since:  v1.0.0
        """

        src_path = "src" + path.sep

        if (infile[:4] == src_path): infile = path.join(Sdist._build_target_path, infile)

        return _sdist.copy_file(self, infile, outfile, **kwargs)
Exemplo n.º 7
0
    def copy_file(self, infile, outfile, **kwargs):
        """
python.org: Copy a file respecting verbose, dry-run and force flags.

:return: (tuple) Tuple (dest_name, copied)
:since:  v1.0.0
        """

        src_path = "src" + path.sep

        if (infile[:4] == src_path):
            infile = path.join(Sdist._build_target_path, infile)

        return _sdist.copy_file(self, infile, outfile, **kwargs)
Exemplo n.º 8
0
    def copy_file(self, f, install_dir, **kwargs):
        """Specialized version of copy_file that checks for stray passwords."""

        # If this is the configuration file, check for passwords
        if f == 'weewx.conf':
            import configobj
            config = configobj.ConfigObj(f)

            for section in ['StdRESTful', 'StdReport']:
                for subsection in config[section].sections:
                    try:
                        password = config[section][subsection]['password']
                        if password != 'replace_me':
                            sys.exit("\n*** [%s][[%s]] password found in configuration file. Aborting ***\n\n" \
                                     % (section, subsection))
                    except KeyError:
                        pass

        # Pass on to my superclass:
        return sdist.copy_file(self, f, install_dir, **kwargs)
Exemplo n.º 9
0
Arquivo: setup.py Projeto: mjuric/lsd
	def copy_file(self, infile, outfile, preserve_mode=1, preserve_times=1, link=None, level=1):
		if infile == 'src/lsd/version.py':
			write_version_file(outfile)
		else:
			_sdist.copy_file(self, infile, outfile, preserve_mode, preserve_times, link, level)