Psyduck - 可達鴨 之 鴨力山大2


Server : LiteSpeed
System : Linux premium217.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User : alloknri ( 880)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /lib/python3.6/site-packages/setuptools/command/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3.6/site-packages/setuptools/command/rotate.py
from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsOptionError
import os
import shutil

from setuptools.extern import six

from setuptools import Command


class rotate(Command):
    """Delete older distributions"""

    description = "delete older distributions, keeping N newest files"
    user_options = [
        ('match=', 'm', "patterns to match (required)"),
        ('dist-dir=', 'd', "directory where the distributions are"),
        ('keep=', 'k', "number of matching distributions to keep"),
    ]

    boolean_options = []

    def initialize_options(self):
        self.match = None
        self.dist_dir = None
        self.keep = None

    def finalize_options(self):
        if self.match is None:
            raise DistutilsOptionError(
                "Must specify one or more (comma-separated) match patterns "
                "(e.g. '.zip' or '.egg')"
            )
        if self.keep is None:
            raise DistutilsOptionError("Must specify number of files to keep")
        try:
            self.keep = int(self.keep)
        except ValueError:
            raise DistutilsOptionError("--keep must be an integer")
        if isinstance(self.match, six.string_types):
            self.match = [
                convert_path(p.strip()) for p in self.match.split(',')
            ]
        self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))

    def run(self):
        self.run_command("egg_info")
        from glob import glob

        for pattern in self.match:
            pattern = self.distribution.get_name() + '*' + pattern
            files = glob(os.path.join(self.dist_dir, pattern))
            files = [(os.path.getmtime(f), f) for f in files]
            files.sort()
            files.reverse()

            log.info("%d file(s) matching %s", len(files), pattern)
            files = files[self.keep:]
            for (t, f) in files:
                log.info("Deleting %s", f)
                if not self.dry_run:
                    if os.path.isdir(f):
                        shutil.rmtree(f)
                    else:
                        os.unlink(f)
Name
Size
Permissions
Options
__pycache__
--
drwxr-xr-x
__init__.py
0.58 KB
-rw-r--r--
alias.py
2.369 KB
-rw-r--r--
bdist_egg.py
17.759 KB
-rw-r--r--
bdist_rpm.py
1.473 KB
-rw-r--r--
bdist_wininst.py
0.622 KB
-rw-r--r--
build_clib.py
4.379 KB
-rw-r--r--
build_ext.py
12.864 KB
-rw-r--r--
build_py.py
9.371 KB
-rw-r--r--
develop.py
7.857 KB
-rw-r--r--
dist_info.py
0.938 KB
-rw-r--r--
easy_install.py
85.16 KB
-rw-r--r--
egg_info.py
24.219 KB
-rw-r--r--
install.py
4.573 KB
-rw-r--r--
install_egg_info.py
2.151 KB
-rw-r--r--
install_lib.py
3.75 KB
-rw-r--r--
install_scripts.py
2.382 KB
-rw-r--r--
launcher manifest.xml
0.613 KB
-rw-r--r--
py36compat.py
4.869 KB
-rw-r--r--
register.py
0.264 KB
-rw-r--r--
rotate.py
2.113 KB
-rw-r--r--
saveopts.py
0.643 KB
-rw-r--r--
sdist.py
6.554 KB
-rw-r--r--
setopt.py
4.966 KB
-rw-r--r--
test.py
8.998 KB
-rw-r--r--
upload.py
1.145 KB
-rw-r--r--
upload_docs.py
7.14 KB
-rw-r--r--