mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 01:47:36 +03:00 
			
		
		
		
	Moving publish command to setup.py
This commit is contained in:
		
							parent
							
								
									e38d2664ea
								
							
						
					
					
						commit
						5116a57aea
					
				| 
						 | 
					@ -10,7 +10,7 @@ manager = Manager()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@manager.command
 | 
					@manager.command
 | 
				
			||||||
def publish(with_tag=True):
 | 
					def publish(with_tag=True):
 | 
				
			||||||
    """Publish current version to PyPi."""
 | 
					    """Publishg current version to PyPi."""
 | 
				
			||||||
    os.system('python setup.py sdist upload')
 | 
					    os.system('python setup.py sdist upload')
 | 
				
			||||||
    if with_tag:
 | 
					    if with_tag:
 | 
				
			||||||
        tag()
 | 
					        tag()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										40
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								setup.py
									
									
									
									
									
								
							| 
						 | 
					@ -2,18 +2,20 @@
 | 
				
			||||||
`Objects` setup script.
 | 
					`Objects` setup script.
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
from setuptools import setup
 | 
					from setuptools import setup
 | 
				
			||||||
 | 
					from setuptools import Command
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DESCRIPTION = 'Dependency management tool for Python projects'
 | 
					SHORT_DESCRIPTION = 'Dependency management tool for Python projects'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Getting description.
 | 
					# Getting description.
 | 
				
			||||||
with open('README.rst') as readme_file:
 | 
					with open('README.rst') as readme_file:
 | 
				
			||||||
    description = readme_file.read()
 | 
					    description = readme_file.read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Removing duplicated description
 | 
					    # Removing duplicated short description.
 | 
				
			||||||
    description = description.replace(DESCRIPTION, '')
 | 
					    description = description.replace(SHORT_DESCRIPTION, '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Getting requirements.
 | 
					# Getting requirements.
 | 
				
			||||||
| 
						 | 
					@ -26,11 +28,29 @@ with open('VERSION') as version:
 | 
				
			||||||
    version = version.read().strip()
 | 
					    version = version.read().strip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					class PublishCommand(Command):
 | 
				
			||||||
    setup(
 | 
					
 | 
				
			||||||
        name='Objects',
 | 
					    """Setuptools `publish` command."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    description = "Publish current distribution to PyPi and create tag"
 | 
				
			||||||
 | 
					    user_options = tuple()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def initialize_options(self):
 | 
				
			||||||
 | 
					        """Init options."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def finalize_options(self):
 | 
				
			||||||
 | 
					        """Finalize options."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def run(self):
 | 
				
			||||||
 | 
					        """Command execution."""
 | 
				
			||||||
 | 
					        os.system('python setup.py sdist upload')
 | 
				
			||||||
 | 
					        os.system('git tag -a {0} -m \'version {0}\''.format(version))
 | 
				
			||||||
 | 
					        os.system('git push --tags')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					setup(name='Objects',
 | 
				
			||||||
      version=version,
 | 
					      version=version,
 | 
				
			||||||
        description='Dependency management tool for Python projects',
 | 
					      description=SHORT_DESCRIPTION,
 | 
				
			||||||
      long_description=description,
 | 
					      long_description=description,
 | 
				
			||||||
      author='Roman Mogilatov',
 | 
					      author='Roman Mogilatov',
 | 
				
			||||||
      author_email='rmogilatov@gmail.com',
 | 
					      author_email='rmogilatov@gmail.com',
 | 
				
			||||||
| 
						 | 
					@ -41,6 +61,9 @@ if __name__ == '__main__':
 | 
				
			||||||
      packages=['objects'],
 | 
					      packages=['objects'],
 | 
				
			||||||
      zip_safe=True,
 | 
					      zip_safe=True,
 | 
				
			||||||
      install_requires=requirements,
 | 
					      install_requires=requirements,
 | 
				
			||||||
 | 
					      cmdclass={
 | 
				
			||||||
 | 
					          'publish': PublishCommand,
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
      keywords=['Dependency management',
 | 
					      keywords=['Dependency management',
 | 
				
			||||||
                'Dependency injection',
 | 
					                'Dependency injection',
 | 
				
			||||||
                'Dependency injection container',
 | 
					                'Dependency injection container',
 | 
				
			||||||
| 
						 | 
					@ -69,5 +92,4 @@ if __name__ == '__main__':
 | 
				
			||||||
          'Topic :: Software Development',
 | 
					          'Topic :: Software Development',
 | 
				
			||||||
          'Topic :: Software Development :: Libraries',
 | 
					          'Topic :: Software Development :: Libraries',
 | 
				
			||||||
          'Topic :: Software Development :: Libraries :: Python Modules',
 | 
					          'Topic :: Software Development :: Libraries :: Python Modules',
 | 
				
			||||||
        ]
 | 
					      ])
 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user