nficano commited on
Commit
88d710d
·
1 Parent(s): f83167c

fixed setup

Browse files
Files changed (1) hide show
  1. setup.py +48 -10
setup.py CHANGED
@@ -1,16 +1,48 @@
1
  #!/usr/bin/env python
2
  # -*- coding: utf-8 -*-
3
  """This module contains setup instructions for pytube."""
4
- try:
5
- from setuptools import setup
6
- except ImportError:
7
- from distutils.core import setup
8
 
9
- with open('README.md') as readme_file:
10
- readme = readme_file.read()
11
 
12
- with open('LICENSE') as readme_file:
13
- license = readme_file.read()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  setup(
16
  name='pytube',
@@ -18,8 +50,11 @@ setup(
18
  author='Nick Ficano',
19
  author_email='[email protected]',
20
  packages=['pytube', 'pytube.contrib'],
 
 
 
21
  url='https://github.com/nficano/pytube',
22
- license=license,
23
  entry_points={
24
  'console_scripts': [
25
  'pytube = pytube.cli:main',
@@ -48,6 +83,9 @@ setup(
48
  'Topic :: Utilities',
49
  ],
50
  description=('A pythonic library for downloading YouTube Videos.'),
51
- long_description=readme,
 
 
52
  zip_safe=True,
 
53
  )
 
1
  #!/usr/bin/env python
2
  # -*- coding: utf-8 -*-
3
  """This module contains setup instructions for pytube."""
4
+ import codecs
5
+ import os
6
+ import sys
7
+ from shutil import rmtree
8
 
9
+ from setuptools import Command
10
+ from setuptools import setup
11
 
12
+ here = os.path.abspath(os.path.dirname(__file__))
13
+
14
+ with codecs.open(os.path.join(here, 'README.md'), encoding='utf-8') as fh:
15
+ long_description = '\n' + fh.read()
16
+
17
+
18
+ class UploadCommand(Command):
19
+ """Support setup.py publish."""
20
+
21
+ description = 'Build and publish the package.'
22
+ user_options = []
23
+
24
+ @staticmethod
25
+ def status(s):
26
+ """Prints things in bold."""
27
+ print('\033[1m{0}\033[0m'.format(s))
28
+
29
+ def initialize_options(self):
30
+ pass
31
+
32
+ def finalize_options(self):
33
+ pass
34
+
35
+ def run(self):
36
+ try:
37
+ self.status('Removing previous builds ...')
38
+ rmtree(os.path.join(here, 'dist'))
39
+ except Exception:
40
+ pass
41
+ self.status('Building Source distribution ...')
42
+ os.system('{0} setup.py sdist bdist_wheel'.format(sys.executable))
43
+ self.status('Uploading the package to PyPI via Twine ...')
44
+ os.system('twine upload dist/*')
45
+ sys.exit()
46
 
47
  setup(
48
  name='pytube',
 
50
  author='Nick Ficano',
51
  author_email='[email protected]',
52
  packages=['pytube', 'pytube.contrib'],
53
+ package_data={
54
+ '': ['LICENSE'],
55
+ },
56
  url='https://github.com/nficano/pytube',
57
+ license='MIT',
58
  entry_points={
59
  'console_scripts': [
60
  'pytube = pytube.cli:main',
 
83
  'Topic :: Utilities',
84
  ],
85
  description=('A pythonic library for downloading YouTube Videos.'),
86
+ include_package_data=True,
87
+ long_description_content_type='text/markdown',
88
+ long_description=long_description,
89
  zip_safe=True,
90
+ cmdclass={'upload': UploadCommand},
91
  )