示例#1
0
 def git_clear_build(self):
     logger.info('{} build clear'.format(self.name))
     run_shell_list([
         'rm -rf {}.egg-info'.format(self.name),
         'rm -rf dist',
         'rm -rf build',
     ])
示例#2
0
 def git_push(self):
     """
     git push
     """
     logger.info("{} push".format(self.name))
     run_shell_list(['git add -A', 'git commit -a -m "add"', 'git push'])
     self.repo.index.add(f"{self.repo_path}/*")
     self.repo.index.commit(message='add')
     self.repo.remote().pull()
示例#3
0
 def git_clean(self):
     """
     git clean
     """
     logger.info('{} clean'.format(self.name))
     run_shell_list([
         'git rm -r --cached .', 'git add .',
         "git commit -m 'update .gitignore'", 'git gc --aggressive'
     ])
示例#4
0
 def git_install(self):
     """
     git install
     """
     logger.info('{} install'.format(self.name))
     run_shell_list([
         'pip uninstall {} -y'.format(self.name),
         'python3 setup.py install', 'rm -rf {}.egg-info'.format(self.name),
         'rm -rf dist', 'rm -rf build'
     ])
     self.git_clear_build()
示例#5
0
 def git_clean_history(self):
     """
     git build
     """
     logger.info('{} clean history'.format(self.name))
     run_shell_list([
         'git checkout --orphan latest_branch',  # 1.Checkout
         'git add -A',  # 2. Add all the files
         'git commit -am "clear history"',  # 3. Commit the changes
         'git branch -D master',  # 4. Delete the branch
         'git branch -m master',  # 5.Rename the current branch to master
         'git push -f origin master',  # 6.Finally, force update your repository
     ])
示例#6
0
    def git_build(self):
        """
        git build
        """
        logger.info('{} build'.format(self.name))
        self.git_pull()
        self.git_clear_build()
        self.version_manage.add()
        self.version_manage.write()
        run_shell_list([
            'python3 setup.py build',  # 编译
            'python3 setup.py sdist',  # 生成 tar.gz
            'python3 setup.py bdist_egg',  # 生成 egg 包
            'python3 setup.py bdist_wheel',  # 生成 wheel 包

            # twine register dist/*
            'twine upload dist/*'  # 发布包
        ])
        self.git_clear_build()
        self.git_push()
        self.git_tags()
        self.pip_install()