File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change 1
- from setuptools import setup , find_packages
1
+ import os
2
+ from setuptools import setup , find_packages , Command
2
3
3
4
from pathlib import Path
4
5
this_directory = Path (__file__ ).parent
5
6
long_description = (this_directory / "README.md" ).read_text ()
6
7
8
+
9
+ class BuildCommand (Command ):
10
+ description = 'Build the package'
11
+ user_options = []
12
+
13
+ def initialize_options (self ):
14
+ pass
15
+
16
+ def finalize_options (self ):
17
+ pass
18
+
19
+ def run (self ):
20
+ os .system ('python setup.py sdist' )
21
+
22
+
23
+ class PublishCommand (Command ):
24
+ description = 'Publish the package to PyPI'
25
+ user_options = [('version=' , 'v' , 'version number of the package to be uploaded' )]
26
+ version = None
27
+
28
+ def initialize_options (self ):
29
+ pass
30
+
31
+ def finalize_options (self ):
32
+ if self .version is None :
33
+ raise Exception ("Version number is required. Use --version=<version_number>" )
34
+
35
+ def run (self ):
36
+ os .system (f"twine upload ./dist/django-appwrite-{ self .version } .tar.gz" )
37
+
38
+
7
39
setup (
8
40
name = 'django-appwrite' ,
9
41
version = '1.5.0' ,
37
69
"Programming Language :: Python :: 3.9" ,
38
70
"Programming Language :: Python :: 3.10"
39
71
],
72
+ cmdclass = {
73
+ 'build' : BuildCommand ,
74
+ 'publish' : PublishCommand ,
75
+ },
40
76
)
You can’t perform that action at this time.
0 commit comments