mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-24 07:51:44 +00:00
Add clean command to setup.py
This commit is contained in:
parent
77a1d58714
commit
a48f2e965b
26
setup.py
26
setup.py
@ -17,9 +17,10 @@
|
|||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
from sys import argv
|
from sys import argv
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages, Command
|
||||||
|
|
||||||
from compiler.api import compiler as api_compiler
|
from compiler.api import compiler as api_compiler
|
||||||
from compiler.docs import compiler as docs_compiler
|
from compiler.docs import compiler as docs_compiler
|
||||||
@ -44,6 +45,24 @@ with open("README.rst", encoding="utf-8") as f:
|
|||||||
readme = re.sub(r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n", "", f.read())
|
readme = re.sub(r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n", "", f.read())
|
||||||
readme = re.sub(r"\|header\|", "|logo|\n\n|description|\n\n|scheme| |tgcrypto|", readme)
|
readme = re.sub(r"\|header\|", "|logo|\n\n|description|\n\n|scheme| |tgcrypto|", readme)
|
||||||
|
|
||||||
|
|
||||||
|
class Clean(Command):
|
||||||
|
PATHS = "./build ./dist ./Pyrogram.egg-info".split()
|
||||||
|
|
||||||
|
user_options = []
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
for path in self.PATHS:
|
||||||
|
print("removing {}".format(path))
|
||||||
|
shutil.rmtree(path, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="Pyrogram",
|
name="Pyrogram",
|
||||||
version=version,
|
version=version,
|
||||||
@ -85,5 +104,8 @@ setup(
|
|||||||
packages=find_packages(exclude=["compiler*"]),
|
packages=find_packages(exclude=["compiler*"]),
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
install_requires=read("requirements.txt"),
|
install_requires=read("requirements.txt"),
|
||||||
extras_require={"tgcrypto": ["tgcrypto>=1.0.4"]}
|
extras_require={"tgcrypto": ["tgcrypto>=1.0.4"]},
|
||||||
|
cmdclass={
|
||||||
|
"clean": Clean
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user