1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
1919import re
20+ import shutil
2021from sys import argv
2122
22- from setuptools import setup , find_packages
23+ from setuptools import setup , find_packages , Command
2324
2425from compiler .api import compiler as api_compiler
2526from compiler .docs import compiler as docs_compiler
@@ -44,6 +45,24 @@ def read(file: str) -> list:
4445 readme = re .sub (r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n" , "" , f .read ())
4546 readme = re .sub (r"\|header\|" , "|logo|\n \n |description|\n \n |scheme| |tgcrypto|" , readme )
4647
48+
49+ class Clean (Command ):
50+ PATHS = "./build ./dist ./Pyrogram.egg-info" .split ()
51+
52+ user_options = []
53+
54+ def initialize_options (self ):
55+ pass
56+
57+ def finalize_options (self ):
58+ pass
59+
60+ def run (self ):
61+ for path in self .PATHS :
62+ print ("removing {}" .format (path ))
63+ shutil .rmtree (path , ignore_errors = True )
64+
65+
4766setup (
4867 name = "Pyrogram" ,
4968 version = version ,
@@ -85,5 +104,8 @@ def read(file: str) -> list:
85104 packages = find_packages (exclude = ["compiler*" ]),
86105 zip_safe = False ,
87106 install_requires = read ("requirements.txt" ),
88- extras_require = {"tgcrypto" : ["tgcrypto>=1.0.4" ]}
107+ extras_require = {"tgcrypto" : ["tgcrypto>=1.0.4" ]},
108+ cmdclass = {
109+ "clean" : Clean
110+ }
89111)
0 commit comments