def test_search_cpp(self): pkg_dir, dist = self.create_dist() cmd = config(dist) match = cmd.search_cpp(pattern='xxx', body='/* xxx */') self.assertEqual(match, 0) match = cmd.search_cpp(pattern='_configtest', body='/* xxx */') self.assertEqual(match, 1)
def _extra_compile_args(platform): """ We set -Wconversion args here so that we only do Wconversion checks on the code we're compiling and not on cffi itself (as passing -Wconversion in CFLAGS would do). We set no error on sign conversion because some function signatures in LibreSSL differ from OpenSSL have changed on long vs. unsigned long in the past. Since that isn't a precision issue we don't care. """ # make sure the compiler used supports the flags to be added is_gcc = False if get_default_compiler() == "unix": d = dist.Distribution() cmd = config(d) cmd._check_compiler() is_gcc = ( "gcc" in cmd.compiler.compiler[0] or "clang" in cmd.compiler.compiler[0] ) if is_gcc or not ( platform in ["win32", "hp-ux11", "sunos5"] or platform.startswith("aix") ): return ["-Wconversion", "-Wno-error=sign-conversion"] else: return []
def test_search_cpp(self): cmd = missing_compiler_executable(['preprocessor']) if cmd is not None: self.skipTest('The %r command is not found' % cmd) pkg_dir, dist = self.create_dist() cmd = config(dist) match = cmd.search_cpp(pattern='xxx', body='/* xxx */') self.assertEqual(match, 0) match = cmd.search_cpp(pattern='_configtest', body='/* xxx */') self.assertEqual(match, 1)
def test_search_cpp(self): pkg_dir, dist = self.create_dist() cmd = config(dist) # simple pattern searches match = cmd.search_cpp(pattern="xxx", body="/* xxx */") self.assertEqual(match, 0) match = cmd.search_cpp(pattern="_configtest", body="/* xxx */") self.assertEqual(match, 1)
def test_finalize_options(self): pkg_dir, dist = self.create_dist() cmd = config(dist) cmd.include_dirs = 'one%stwo' % os.pathsep cmd.libraries = 'one' cmd.library_dirs = 'three%sfour' % os.pathsep cmd.ensure_finalized() self.assertEqual(cmd.include_dirs, ['one', 'two']) self.assertEqual(cmd.libraries, ['one']) self.assertEqual(cmd.library_dirs, ['three', 'four'])
def test_search_cpp(self): if sys.platform == 'win32': return pkg_dir, dist = self.create_dist() cmd = config(dist) # simple pattern searches match = cmd.search_cpp(pattern='xxx', body='// xxx') self.assertEquals(match, 0) match = cmd.search_cpp(pattern='_configtest', body='// xxx') self.assertEquals(match, 1)
def test_search_cpp(self): if sys.platform == 'win32': return pkg_dir, dist = self.create_dist() cmd = config(dist) # simple pattern searches match = cmd.search_cpp(pattern='xxx', body='// xxx') self.assertEqual(match, 0) match = cmd.search_cpp(pattern='_configtest', body='// xxx') self.assertEqual(match, 1)
def test_clean(self): tmp_dir = self.mkdtemp() f1 = os.path.join(tmp_dir, 'one') f2 = os.path.join(tmp_dir, 'two') self.write_file(f1, 'xxx') self.write_file(f2, 'xxx') for f in (f1, f2): self.assertTrue(os.path.exists(f)) pkg_dir, dist = self.create_dist() cmd = config(dist) cmd._clean(f1, f2) for f in (f1, f2): self.assertFalse(os.path.exists(f))
def test_finalize_options(self): # finalize_options does a bit of transformation # on options pkg_dir, dist = self.create_dist() cmd = config(dist) cmd.include_dirs = "one%stwo" % os.pathsep cmd.libraries = "one" cmd.library_dirs = "three%sfour" % os.pathsep cmd.ensure_finalized() self.assertEqual(cmd.include_dirs, ["one", "two"]) self.assertEqual(cmd.libraries, ["one"]) self.assertEqual(cmd.library_dirs, ["three", "four"])
def test_search_cpp(self): cmd = missing_compiler_executable(['preprocessor']) if cmd is not None: self.skipTest('The %r command is not found' % cmd) pkg_dir, dist = self.create_dist() cmd = config(dist) # simple pattern searches match = cmd.search_cpp(pattern='xxx', body='/* xxx */') self.assertEqual(match, 0) match = cmd.search_cpp(pattern='_configtest', body='/* xxx */') self.assertEqual(match, 1)
def test_search_cpp(self): cmd = missing_compiler_executable(['preprocessor']) if cmd is not None: self.skipTest('The %r command is not found' % cmd) pkg_dir, dist = self.create_dist() cmd = config(dist) cmd._check_compiler() compiler = cmd.compiler if sys.platform[:3] == "aix" and "xlc" in compiler.preprocessor[0].lower(): self.skipTest('xlc: The -E option overrides the -P, -o, and -qsyntaxonly options') # simple pattern searches match = cmd.search_cpp(pattern='xxx', body='/* xxx */') self.assertEqual(match, 0) match = cmd.search_cpp(pattern='_configtest', body='/* xxx */') self.assertEqual(match, 1)
def test_clean(self): # _clean removes files tmp_dir = self.mkdtemp() f1 = os.path.join(tmp_dir, "one") f2 = os.path.join(tmp_dir, "two") self.write_file(f1, "xxx") self.write_file(f2, "xxx") for f in (f1, f2): self.assertTrue(os.path.exists(f)) pkg_dir, dist = self.create_dist() cmd = config(dist) cmd._clean(f1, f2) for f in (f1, f2): self.assertTrue(not os.path.exists(f))
def test_search_cpp(self): import shutil cmd = missing_compiler_executable(['preprocessor']) if cmd is not None: self.skipTest('The %r command is not found' % cmd) pkg_dir, dist = self.create_dist() cmd = config(dist) cmd._check_compiler() compiler = cmd.compiler is_xlc = shutil.which(compiler.preprocessor[0]).startswith("/usr/vac") if is_xlc: self.skipTest('xlc: The -E option overrides the -P, -o, and -qsyntaxonly options') # simple pattern searches match = cmd.search_cpp(pattern='xxx', body='/* xxx */') self.assertEqual(match, 0) match = cmd.search_cpp(pattern='_configtest', body='/* xxx */') self.assertEqual(match, 1)
import os from distutils.command.config import config from decouple import config, Csv from dj_database_url import parse as dburl # Build paths inside the project like this: os.path.join(BASE_DIR, ...) from django import conf BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', default=False, cast=bool) ALLOWED_HOSTS = config('ALLOWED_HOSTS', default=[], cast=Csv()) DEFAULT_FROM_EMAIL = '*****@*****.**' # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions',
https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) from distutils.command.config import config BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', default=False, cast=bool) ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages',
For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ import os from distutils.command.config import config from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config('DEBUG', cast=bool, default=False) ALLOWED_HOSTS = config('ALLOWED_HOSTS').split(',') # Application definition INSTALLED_APPS = [ #adminreconf 'account', #myapps 'mainapp', 'cart', 'orders',