From d6a0fcf4adaacf9315a41282904c0f89cc9aed1e Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 25 Aug 2018 14:22:19 +0200 Subject: [PATCH] Also clean docs generated files --- setup.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index f9153dfe..929222db 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +import os import re import shutil from sys import argv @@ -58,7 +59,9 @@ class Clean(Command): "pyrogram/api/errors/exceptions", "pyrogram/api/functions", "pyrogram/api/types", - "pyrogram/api/all.py" + "pyrogram/api/all.py", + "docs/source/functions", + "docs/source/types" ] user_options = [] @@ -71,9 +74,12 @@ class Clean(Command): def run(self): for path in self.PATHS: - print("removing {}".format(path)) - shutil.rmtree(path, ignore_errors=True) - + try: + shutil.rmtree(path) if os.path.isdir(path) else os.remove(path) + except OSError: + print("skipping {}".format(path)) + else: + print("removing {}".format(path)) setup( name="Pyrogram",