Skip to content

Commit d6a0fcf

Browse files
committed
Also clean docs generated files
1 parent c9a946b commit d6a0fcf

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

setup.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import os
1920
import re
2021
import shutil
2122
from sys import argv
@@ -58,7 +59,9 @@ class Clean(Command):
5859
"pyrogram/api/errors/exceptions",
5960
"pyrogram/api/functions",
6061
"pyrogram/api/types",
61-
"pyrogram/api/all.py"
62+
"pyrogram/api/all.py",
63+
"docs/source/functions",
64+
"docs/source/types"
6265
]
6366

6467
user_options = []
@@ -71,9 +74,12 @@ def finalize_options(self):
7174

7275
def run(self):
7376
for path in self.PATHS:
74-
print("removing {}".format(path))
75-
shutil.rmtree(path, ignore_errors=True)
76-
77+
try:
78+
shutil.rmtree(path) if os.path.isdir(path) else os.remove(path)
79+
except OSError:
80+
print("skipping {}".format(path))
81+
else:
82+
print("removing {}".format(path))
7783

7884
setup(
7985
name="Pyrogram",

0 commit comments

Comments
 (0)