github.com/whamcloud/lemur@v0.0.0-20190827193804-4655df8a52af/packaging/ci/lambda/GitPullS3/pygit2/_build.py (about) 1 # -*- coding: utf-8 -*- 2 # 3 # Copyright 2010-2015 The pygit2 contributors 4 # 5 # This file is free software; you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License, version 2, 7 # as published by the Free Software Foundation. 8 # 9 # In addition to the permissions in the GNU General Public License, 10 # the authors give you unlimited permission to link the compiled 11 # version of this file into combinations with other programs, 12 # and to distribute those combinations without any restriction 13 # coming from the use of this file. (The General Public License 14 # restrictions do apply in other respects; for example, they cover 15 # modification of the file, and distribution when not linked into 16 # a combined executable.) 17 # 18 # This file is distributed in the hope that it will be useful, but 19 # WITHOUT ANY WARRANTY; without even the implied warranty of 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 # General Public License for more details. 22 # 23 # You should have received a copy of the GNU General Public License 24 # along with this program; see the file COPYING. If not, write to 25 # the Free Software Foundation, 51 Franklin Street, Fifth Floor, 26 # Boston, MA 02110-1301, USA. 27 28 """ 29 This is an special module, it provides stuff used by setup.py at build time. 30 But also used by pygit2 at run time. 31 """ 32 33 # Import from the Standard Library 34 import os 35 from os import getenv 36 37 # 38 # The version number of pygit2 39 # 40 __version__ = '0.24.1' 41 42 43 # 44 # Utility functions to get the paths required for bulding extensions 45 # 46 def _get_libgit2_path(): 47 # LIBGIT2 environment variable takes precedence 48 libgit2_path = getenv("LIBGIT2") 49 if libgit2_path is not None: 50 return libgit2_path 51 52 # Default 53 if os.name == 'nt': 54 return '%s\libgit2' % getenv("ProgramFiles") 55 return '/usr/local' 56 57 58 def get_libgit2_paths(): 59 libgit2_path = _get_libgit2_path() 60 return ( 61 os.path.join(libgit2_path, 'bin'), 62 os.path.join(libgit2_path, 'include'), 63 getenv('LIBGIT2_LIB', os.path.join(libgit2_path, 'lib')), 64 )