SiCKRAGE.py 1.3 KB
Newer Older
echel0n's avatar
echel0n committed
1
#!/usr/bin/env python2.7
2
# Author: echel0n <[email protected]>
echel0n's avatar
echel0n committed
3
# URL: https://sickrage.ca
4
#
echel0n's avatar
echel0n committed
5
# This file is part of SickRage.
6
#
echel0n's avatar
echel0n committed
7
# SickRage is free software: you can redistribute it and/or modify
8 9 10 11
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
echel0n's avatar
echel0n committed
12
# SickRage is distributed in the hope that it will be useful,
13 14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16 17
#
# You should have received a copy of the GNU General Public License
echel0n's avatar
echel0n committed
18
# along with SickRage.  If not, see <http://www.gnu.org/licenses/>.
19

20
import os
21

22
if __name__ == '__main__':
23
    # removes stale .pyc files
24
    for root, dirs, files in os.walk(os.path.dirname(__file__)):
25 26 27 28 29 30 31
        pyc_files = filter(lambda filename: filename.endswith(".pyc"), files)
        py_files = set(filter(lambda filename: filename.endswith(".py"), files))
        excess_pyc_files = filter(lambda pyc_filename: pyc_filename[:-1] not in py_files, pyc_files)
        for excess_pyc_file in excess_pyc_files:
            full_path = os.path.join(root, excess_pyc_file)
            os.remove(full_path)

32
    from sickrage import main
33

34
    main()