def main(): bower_package = sys.argv[1] if subprocess.call('node_modules/.bin/bower install {}'.format( bower_package), shell=True): return # safe name for Python package - lowercase and replace dashes name = bower_package.lower().replace('-', '_') with open(join('bower_components', bower_package, '.bower.json')) as f: bower_json = json.load(f) display_name = bower_json['name'] version = bower_json['version'] underline = '-' * len('xstatic-' + display_name) homepage = bower_json['homepage'] if 'main' in bower_json: main = "MAIN=\"{}\"".format(bower_json['main']) else: main = '' keywords = ' '.join(bower_json.get('keywords', []) + [name, 'xstatic']) # TODO? (I'm not sure this stuff even exists in bower) cdn_locations = '' # grab maintainer info from git config git = gitconfig.config("~/.gitconfig") maintainer = "MAINTAINER = '{}'\nMAINTAINER_EMAIL = '{}'".format( git.user.name, git.user.email) # make that deep directory xstatic_dir = join('xstatic_packages', name, 'xstatic') if os.path.exists(xstatic_dir): shutil.rmtree(xstatic_dir) os.makedirs(join(xstatic_dir, 'pkg', name)) with open(join(xstatic_dir, '__init__.py'), 'w') as f: f.write("__import__('pkg_resources').declare_namespace(__name__)\n") with open(join(xstatic_dir, 'pkg', '__init__.py'), 'w') as f: f.write("__import__('pkg_resources').declare_namespace(__name__)\n") # copy over the data shutil.copytree(join('bower_components', bower_package), join(xstatic_dir, 'pkg', name, 'data')) # write the package meta-data with open(join('xstatic_packages', name, 'README.txt'), 'w') as f: f.write(README_TEMPLATE.format(**locals())) with open(join('xstatic_packages', name, 'setup.py'), 'w') as f: f.write(SETUP_PY_TEMPLATE.format(**locals())) with open(join('xstatic_packages', name, 'MANIFEST.in'), 'w') as f: f.write(MANIFEST_IN_TEMPLATE.format(**locals())) with open(join(xstatic_dir, 'pkg', name, '__init__.py'), 'w') as f: f.write(__INIT__TEMPLATE.format(**locals())) print '\nCongratulations, please find your new XStatic-{} package in' \ .format(display_name) print join('xstatic_packages', name), '\n'
def main(): username = getpass.getuser() if username == "vagrant": import gitconfig print("You are running a vagrant so we need to check your .gitconfig") config = gitconfig.config("~/.gitconfig") if not config.user.name or config.user.name == "YourName": from subprocess import Popen print("Your DotFiles is misconfigured in BriteCore-Up:") print("You are still using the IntuitiveWebSolutions branch.") print("For now, we are just going to fix your .gitconfig on your Vagrant.") config.user.name = raw_input("Enter your first and last name: ") config.user.github = raw_input("GitHub username: "******"GitHub email address: ") Popen("touch ~/.config/git_check", shell=True) Popen("expand -t 4 ~/.gitconfig > ~/.gitconfig.new && mv ~/.gitconfig.new ~/.gitconfig", shell=True) else: print("Everything looks good!")
def main(): username = getpass.getuser() if username == 'vagrant': import gitconfig print("You are running a vagrant so we need to check your .gitconfig") config = gitconfig.config("~/.gitconfig") if not config.user.name or config.user.name == "YourName": from subprocess import Popen print("Your DotFiles is misconfigured in BriteCore-Up:") print("You are still using the IntuitiveWebSolutions branch.") print( "For now, we are just going to fix your .gitconfig on your Vagrant." ) config.user.name = raw_input('Enter your first and last name: ') config.user.github = raw_input('GitHub username: '******'GitHub email address: ') Popen("touch ~/.config/git_check", shell=True) Popen( "expand -t 4 ~/.gitconfig > ~/.gitconfig.new && mv ~/.gitconfig.new ~/.gitconfig", shell=True) else: print("Everything looks good!")
def setUpClass(cls): cls.f = ".test" cls.config = None if exists(cls.f): unlink(cls.f) cls.config = config(cls.f)
def setUpClass(cls): cls.filename = os.path.expanduser("~/.gitconfig_test") if os.path.exists(cls.filename): os.unlink(cls.filename) cls.config = gitconfig.config("~/.gitconfig_test")